docker
1. 拉docker镜像:docker pull python:2.7.12
2. 进入docker容器:docker run -i -t python:2.7.12 /bin/bash
3.查看正在运行的docker容器:docker ps
4.查看所有docker容器:docker ps -a
5.将docker容器创建成镜像:docker commit -m "installed tornado,requests,jinja2" -a "aaron_agu" 33dea1a97deb python2.7.12.tornado
-m:和git一样-m是说明,-a:创建着,33dea1a97deb:docker 容器ID实际用自己3/4步骤查出来的,python2.7.12.tornado:新镜像名称
6.映射多个端口:docker run -p host_port1:port1 -p host_port2:port2 -p host_port3:port3 image
7.执行多个命令:nohup 'docker run -p host_port1:port1 /bin/bash -c "service memcached start && python /home/admin.py"' >> /home/log.txt 2>&1 &
docker run -p 8890:8890 -v /home/aaron/project:/home tornado_rls1 "service memcached start && python /home/czj/admin.py"
apt-get install apt-transport-https ca-certificates
Dockerfile demo
FROM tornado_rls1
MAINTAINER aaron "690753863@qq.com"
RUN pip install simplejson
VOLUME /home
EXPOSE 8890
CMD /bin/bash -c "service memcached start && python /home/czj/admin.py 8890"
根据dockerfile创建images
docker build -t tornado0 .
启动
docker run -p 8890:8890 -v /home/aaron/project:/home tornado0 > /tmp/wxstore.log 2>&1 &
文章出处:http://www.cnblogs.com/aaron-agu/
只有毅力和决心才能使人真正具有价值!