日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Docker教程:Dockerfile基本結(jié)構(gòu)

Dockerfile 由一行行命令語句組成,并且支持以 # 開頭的注釋行。

成都創(chuàng)新互聯(lián)溝通電話:028-86922220,為您提供成都網(wǎng)站建設(shè)網(wǎng)頁設(shè)計及定制高端網(wǎng)站建設(shè)服務(wù),成都創(chuàng)新互聯(lián)網(wǎng)頁制作領(lǐng)域十載,包括主動防護網(wǎng)等多個方面擁有多年的網(wǎng)站營銷經(jīng)驗,選擇成都創(chuàng)新互聯(lián),為企業(yè)保駕護航!

一般的,Dockerfile 分為四部分:基礎(chǔ)鏡像信息、維護者信息、鏡像操作指令和容器啟動時執(zhí)行指令。

例如

# This dockerfile uses the ubuntu image
# VERSION 2 - EDITION 1
# Author: docker_user
# Command format: Instruction [arguments / command] ..

# Base image to use, this must be set as the first line
FROM ubuntu

# Maintainer: docker_user  (@docker_user)
MAINTAINER docker_user docker_user@email.com

# Commands to update the image
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

# Commands when creating a new container
CMD /usr/sbin/nginx

其中,一開始必須指明所基于的鏡像名稱,接下來推薦說明維護者信息。

后面則是鏡像操作指令,例如 RUN 指令,RUN 指令將對鏡像執(zhí)行跟隨的命令。每運行一條 RUN 指令,鏡像添加新的一層,并提交。

最后是 CMD 指令,來指定運行容器時的操作命令。

下面是一個更復(fù)雜的例子

# Nginx
#
# VERSION               0.0.1

FROM      ubuntu
MAINTAINER Victor Vieux 

RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server

# Firefox over VNC
#
# VERSION               0.3

FROM ubuntu

# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get update && apt-get install -y x11vnc xvfb firefox
RUN mkdir /.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'

EXPOSE 5900
CMD    ["x11vnc", "-forever", "-usepw", "-create"]

# Multiple images example
#
# VERSION               0.1

FROM ubuntu
RUN echo foo > bar
# Will output something like ===> 907ad6c2736f

FROM ubuntu
RUN echo moo > oink
# Will output something like ===> 695d7793cbe4

# You?ll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with
# /oink.

新聞標(biāo)題:創(chuàng)新互聯(lián)Docker教程:Dockerfile基本結(jié)構(gòu)
轉(zhuǎn)載注明:http://www.dlmjj.cn/article/dpjsish.html