#打包鏡像 docker build --tag=friendlyhello . #運行鏡像 docker run -d -p 4000:80 friendlyhello #查看容器日誌 docker logs -f -t --since="2018-03-31" --tail=100 charming_hugle charming_hugle是容器NAME而不是ID ,運行docker ps 能夠獲得
docker部署pyspark測試簡單的本地wordcount案例docker
#查找 docker search pyspark #拉取對應的版本 docker pull fokkodriesprong/docker-pyspark #啓動 docker run -it -h sandbox fokkodriesprong/docker-pyspark bash #啓動單核模式 spark-shell --master yarn-client --driver-memory 512m --executor-memory 512m --executor-cores 1 #單機測試代碼模式 spark-shell #證實成功 scala> sc.parallelize(1 to 1000).count() res0: Long = 1000 #pyspark測試 echo "hello world" > /root/test.txt echo "hello world 1" >> /root/test.txt echo "hello world 2" >> /root/test.txt cat /root/test.txt pyspark from operator import add text = sc.textFile("/root/test.txt") text.count() text.flatMap(lambda x: x.split(' ')).map(lambda x: (x, 1)).reduceByKey(add).collect()
---恢復內容結束---shell