docker 常用基础命令

#打包镜像
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 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()

---恢复内容结束---

原文地址:https://www.cnblogs.com/sen-2017/p/11422706.html