dockerhub官网:https://hub.docker.com
1.下载
docker pull python:3.6 #拉取镜像
docker images|grep jdk #查看
docker run -it python:3.6 --mysql.address='192.123.1.327' #前台运行
docker run -it --entrypoint bash python:3.6 #进入镜像
uname -a #查看镜像系统信息
// demo
runoob@runoob:~# docker pull training/webapp # 载入镜像
runoob@runoob:~# docker run -d -P training/webapp python app.py 后台运行
runoob@runoob:~$ docker run -d -p 5000:5000 training/webapp python app.py
2.Dockerfile
# dockerfile.base
FORM python:3.6
MAINTAINER xxx xxx@dgnet.com
RUN pip install thrift
# dockerfile
FORM python-base:latest
MAINTAINER xxx xxx@dgnet.com
COPY message /message
ENTRYPOINT ["python", "/message/message_service.py"]
3.构建镜像
docker build -t user-service:latest .
4.构建脚本build.sh
#!usr/bin/env bash
docker build -t python-base:latest -f Dockerfile.base .
docker build -t message-service:latest .