Docker 基础 : Dockerfile
# This dockerfile uses the Ubuntu image
# VERSION
# Author: docker_user
# Command format: Instruction [arguments / command] …
第一行必须指定基于的容器镜像FROM ubuntu 维护者信息MAINTAINER docker_user docker_user@email.com 镜像的操作指令<span style="color: #000000">RUN echo “deb http://archive.ubuntu.com/ubuntu/ raring main universe” >> /etc/apt/sources.list 容器启动时执行指令CMD /usr/sbin/nginx
RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server
# Firefox over VNC
RUN /.vnc
# setup a password
RUN -storepasswd ~/.vnc/
# Autostart firefox
RUN ba -c ‘“firefox” >> /.bashrc’
EXPOSE
CMD [“x11vnc”,“-forever”,“-usepw”,“-create”]
或 FROM ,指定维护者信息。
LABEL
LABEL =-with-value===
LABEL multi.label1= multi.label2= other=
LABEL multi.label1===
RUN
CMD command param1 param2 在 /bin/<span style="color: #0000ff">sh<span style="color: #000000"> 中执行,提供给需要交互的应用。
CMD [“param1”,“param2”] 提供给 ENTRYPOINT 的默认参数。
EXPOSE
ENV PG_MAJOR .-SL http:
ENV PATH /usr/local/postgres-$PG_MAJOR/bin:$PATH
ADD
到容器中的
COPY
(为 Dockerfile 所在目录的相对路径,文件或目录) 为容器中的
ENTRYPOINT command param1 param2 (shell 中执行)
VOLUME ["/data"]
USER daemon
WORKDIR /path/to/workdir
WORKDIR /
ONBUILD [INSTRUCTION]
/app//usr/local/bin/python-build – /app/
FROM image-/app//usr/local/bin/python-build – /app/src
$ docker build -t build_repo/first_image /tmp/docker_builder/$
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |