# This dockerfile uses the Ubuntu image
# VERSION
# Author: docker_user
# Command format: Instruction [arguments / command] …
第一行必须指定基于的容器镜像
FROM ubuntu
维护者信息
MAINTAINER docker_user [email protected]
镜像的操作指令
<span style="color: #000000">RUN echo “deb http://archive.ubuntu.com/ubuntu/ raring main universe” >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y nginx
RUN echo “\ndaemon off;” >> /etc/nginx/nginx.conf
容器启动时执行指令
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 RUN [“executable”,“param1”,“param2”]。
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/$