DockerFile命令解析

  • azure的示例代码
FROM    tiangolo/uwsgi-nginx-flask:python3.6

COPY sshd_config /etc/ssh/
COPY app_init.supervisord.conf /etc/supervisor/conf.d

RUN  mkdir -p /home/LogFiles \
     && echo "root:Docker!" | chpasswd \
     && echo "cd /home" >> /etc/bash.bashrc \
     && apt update \
     && apt install -y --no-install-recommends openssh-server vim curl wget tcptraceroute

# RUN  pip install redis

EXPOSE 2222 80
 
ADD     /azure-vote /app

ENV PORT 80
ENV PATH ${PATH}:/home/site/wwwroot

# Supervisor will call into /opt/startup/init_container.sh
# Also see: http://blog.trifork.com/2014/03/11/using-supervisor-with-docker-to-manage-processes-supporting-image-inheritance/
CMD ["/usr/bin/supervisord"]

CMD ["python3", "/hello.py"]

另一个例子

  • https://baijiahao.baidu.com/s?id=1718841429139976512&wfr=spider&for=pc

  • FROM 引入基础镜像

  • COPY 拷贝文件到镜像指定目录下

  • RUN 在镜像中执行命令

  • ADD 挂载本地目录到镜像目录,

  • ENV 定义环境变量

  • EXPOSE 定义容器提供的对外端口,不一定用到。

  • CMD 容器启动时运行命令

你可能感兴趣的:(DockerFile命令解析)