- 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"]
另一個(gè)例子
https://baijiahao.baidu.com/s?id=1718841429139976512&wfr=spider&for=pcFROM 引入基礎(chǔ)鏡像
COPY 拷貝文件到鏡像指定目錄下
RUN 在鏡像中執(zhí)行命令
ADD 掛載本地目錄到鏡像目錄,
ENV 定義環(huán)境變量
EXPOSE 定義容器提供的對(duì)外端口,不一定用到。
CMD 容器啟動(dòng)時(shí)運(yùn)行命令