非常詳細(xì)的Docker學(xué)習(xí)筆記_第1頁
非常詳細(xì)的Docker學(xué)習(xí)筆記_第2頁
非常詳細(xì)的Docker學(xué)習(xí)筆記_第3頁
非常詳細(xì)的Docker學(xué)習(xí)筆記_第4頁
非常詳細(xì)的Docker學(xué)習(xí)筆記_第5頁
已閱讀5頁,還剩46頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、閱讀目錄· 1.1 Docker 守護(hù)進(jìn)程 · 1.2 Docker 客戶端 · 1.3 Docker 內(nèi)部 · 1.4 libcontainer · 1.5 命名空間Namespaces · 1.6 資源配額cgroups · 3.1 Search images · 3.2 Pull images · 3.3 Running an interactive shell · 3.4 相關(guān)快捷鍵 · 4.1 docker help · 4.2 docker search 

2、3; 4.3 docker info · 4.4 docker pull && docker push · 4.5 docker images · 4.6 docker rmi · 4.7 docker run · 4.8 docker start|stop|kill. . · 4.9 Docker 1.3 新增特性和命令 · 4.10 Docker 1.5 新特性 · 5.1 自動映射端口 · 5.2 綁定端口到指定接口 · 6.1 Docker 四種網(wǎng)絡(luò)模式 · 6

3、.2 列出當(dāng)前主機網(wǎng)橋 · 6.3 查看當(dāng)前 docker0 ip · 6.4 運行一個容器 · 6.5 不同主機間容器通信 · 7.1 FROM · 7.2 MAINTAINER · 7.3 CMD · 7.4 EXPOSE · 7.5 ENV · 7.6 ADD · 7.7 COPY · 7.8 ENTRYPOINT · 7.9 VOLUME · 7.10 USER · 7.11 WORKDIR · 7.12 ONBUILD · 7

4、.13 Dockerfile Examples · 7.14 docker build · 7.15 dockerfile 最佳實踐 · 8.1 數(shù)據(jù)卷 · 8.2 創(chuàng)建和掛載一個數(shù)據(jù)卷容器 · 8.3 備份、恢復(fù)或遷移數(shù)據(jù)卷 · 8.4 刪除 Volumes · 9.1 容器命名 · 9.2 鏈接容器 · 10.1 快速構(gòu)建 · 10.2 不使用容器構(gòu)建 registry · 10.3 提交指定容器到私有庫 一、Docker 簡介 Docker 兩個主要部件: · Dock

5、er: 開源的容器虛擬化平臺 · Docker Hub: 用于分享、管理 Docker 容器的 Docker SaaS 平臺 - Docker Hub Docker 使用客戶端-服務(wù)器 (C/S) 架構(gòu)模式。Docker 客戶端會與 Docker 守護(hù)進(jìn)程進(jìn)行通信。Docker 守護(hù)進(jìn)程會處理復(fù)雜繁重的任務(wù),例如建立、運行、發(fā)布你的 Docker 容器。Docker 客戶端和守護(hù)進(jìn)程可以運行在同一個系統(tǒng)上,當(dāng)然你也可以使用 Docker 客戶端去連接一個遠(yuǎn)程的 Docker 守護(hù)進(jìn)程。Docker 客戶端和守護(hù)進(jìn)程之間通過 socket 或者 RESTful API 進(jìn)行通信。 1.

6、1 Docker 守護(hù)進(jìn)程 如上圖所示,Docker 守護(hù)進(jìn)程運行在一臺主機上。用戶并不直接和守護(hù)進(jìn)程進(jìn)行交互,而是通過 Docker 客戶端間接和其通信。 回到頂部1.2 Docker 客戶端 Docker 客戶端,實際上是 docker 的二進(jìn)制程序,是主要的用戶與 Docker 交互方式。它接收用戶指令并且與背后的 Docker 守護(hù)進(jìn)程通信,如此來回往復(fù)。 回到頂部1.3 Docker 內(nèi)部 要理解 Docker 內(nèi)部構(gòu)建,需要理解以下三種部件: · Docker 鏡像 - Docker images · Docker 倉庫 - Docker registeries

7、 · Docker 容器 - Docker containers Docker 鏡像 Docker 鏡像是 Docker 容器運行時的只讀模板,每一個鏡像由一系列的層 (layers) 組成。Docker 使用 UnionFS 來將這些層聯(lián)合到單獨的鏡像中。UnionFS 允許獨立文件系統(tǒng)中的文件和文件夾(稱之為分支)被透明覆蓋,形成一個單獨連貫的文件系統(tǒng)。正因為有了這些層的存在,Docker 是如此的輕量。當(dāng)你改變了一個 Docker 鏡像,比如升級到某個程序到新的版本,一個新的層會被創(chuàng)建。因此,不用替換整個原先的鏡像或者重新建立(在使用虛擬機的時候你可能會這么做),只是一個新 的

8、層被添加或升級了?,F(xiàn)在你不用重新發(fā)布整個鏡像,只需要升級,層使得分發(fā) Docker 鏡像變得簡單和快速。 Docker 倉庫 Docker 倉庫用來保存鏡像,可以理解為代碼控制中的代碼倉庫。同樣的,Docker 倉庫也有公有和私有的概念。公有的 Docker 倉庫名字是 Docker Hub。Docker Hub 提供了龐大的鏡像集合供使用。這些鏡像可以是自己創(chuàng)建,或者在別人的鏡像基礎(chǔ)上創(chuàng)建。Docker 倉庫是 Docker 的分發(fā)部分。 Docker 容器 Docker 容器和文件夾很類似,一個Docker容器包含了所有的某個應(yīng)用運行所需要的環(huán)境。每一個 Docker 容器都是從 Dock

9、er 鏡像創(chuàng)建的。Docker 容器可以運行、開始、停止、移動和刪除。每一個 Docker 容器都是獨立和安全的應(yīng)用平臺,Docker 容器是 Docker 的運行部分。 回到頂部1.4 libcontainer Docker 從 0.9 版本開始使用 libcontainer 替代 lxc,libcontainer 和 Linux 系統(tǒng)的交互圖如下: · 圖片來源: Docker 0.9: introducing execution drivers and libcontainer 回到頂部1.5 命名空間Namespaces pid namespace 不同用戶的進(jìn)程就是通過 p

10、id namespace 隔離開的,且不同 namespace 中可以有相同 PID。具有以下特征: · 每個 namespace 中的 pid 是有自己的 pid=1 的進(jìn)程(類似 /sbin/init 進(jìn)程) · 每個 namespace 中的進(jìn)程只能影響自己的同一個 namespace 或子 namespace 中的進(jìn)程 · 因為 /proc 包含正在運行的進(jìn)程,因此在 container 中的 pseudo-filesystem 的 /proc 目錄只能看到自己 namespace 中的進(jìn)程 · 因為 namespace 允許嵌套,父 names

11、pace 可以影響子 namespace 的進(jìn)程,所以子 namespace 的進(jìn)程可以在父 namespace 中看到,但是具有不同的 pid 參考文檔:Introduction to Linux namespaces Part 3: PID mnt namespace 類似 chroot,將一個進(jìn)程放到一個特定的目錄執(zhí)行。mnt namespace 允許不同 namespace 的進(jìn)程看到的文件結(jié)構(gòu)不同,這樣每個 namespace 中的進(jìn)程所看到的文件目錄就被隔離開了。同 chroot 不同,每個 namespace 中的 container 在 /proc/mounts 的信息只包含所

12、在 namespace 的 mount point。 net namespace 網(wǎng)絡(luò)隔離是通過 net namespace 實現(xiàn)的, 每個 net namespace 有獨立的 network devices, IP addresses, IP routing tables, /proc/net 目錄。這樣每個 container 的網(wǎng)絡(luò)就能隔離開來。 docker 默認(rèn)采用 veth 的方式將 container 中的虛擬網(wǎng)卡同 host 上的一個 docker bridge 連接在一起。 參考文檔:Introduction to Linux namespaces Part 5: NET

13、uts namespace UTS ("UNIX Time-sharing System") namespace 允許每個 container 擁有獨立的 hostname 和 domain name, 使其在網(wǎng)絡(luò)上可以被視作一個獨立的節(jié)點而非 Host 上的一個進(jìn)程。 參考文檔:Introduction to Linux namespaces Part 1: UTS ipc namespace container 中進(jìn)程交互還是采用 Linux 常見的進(jìn)程間交互方法 (interprocess communication - IPC), 包括常見的信號量、消息隊列和共享內(nèi)

14、存。然而同 VM 不同,container 的進(jìn)程間交互實際上還是 host 上具有相同 pid namespace 中的進(jìn)程間交互,因此需要在IPC資源申請時加入 namespace 信息 - 每個 IPC 資源有一個唯一的 32bit ID。 參考文檔:Introduction to Linux namespaces Part 2: IPC user namespace 每個 container 可以有不同的 user 和 group id, 也就是說可以以 container 內(nèi)部的用戶在 container 內(nèi)部執(zhí)行程序而非 Host 上的用戶。 有了以上 6 種 namespace

15、從進(jìn)程、網(wǎng)絡(luò)、IPC、文件系統(tǒng)、UTS 和用戶角度的隔離,一個 container 就可以對外展現(xiàn)出一個獨立計算機的能力,并且不同 container 從 OS 層面實現(xiàn)了隔離。 然而不同 namespace 之間資源還是相互競爭的,仍然需要類似 ulimit 來管理每個 container 所能使用的資源 - cgroup。 Reference · Docker Getting Start: Related Knowledge · Docker 介紹以及其相關(guān)術(shù)語、底層原理和技術(shù) 回到頂部1.6 資源配額cgroups cgroups 實現(xiàn)了對資源的配額和度量。 cgro

16、ups 的使用非常簡單,提供類似文件的接口,在 /cgroup 目錄下新建一個文件夾即可新建一個 group,在此文件夾中新建 task 文件,并將 pid 寫入該文件,即可實現(xiàn)對該進(jìn)程的資源控制。具體的資源配置選項可以在該文件夾中新建子 subsystem ,子系統(tǒng)前綴.資源項 是典型的配置方法, 如 memory.usageinbytes 就定義了該 group 在 subsystem memory 中的一個內(nèi)存限制選項。 另外,cgroups 中的 subsystem 可以隨意組合,一個 subsystem 可以在不同的 group 中,也可以一個 group 包含多個 subsyste

17、m - 也就是說一個 subsystem。 · memory o 內(nèi)存相關(guān)的限制 · cpu o 在 cgroup 中,并不能像硬件虛擬化方案一樣能夠定義 CPU 能力,但是能夠定義 CPU 輪轉(zhuǎn)的優(yōu)先級,因此具有較高 CPU 優(yōu)先級的進(jìn)程會更可能得到 CPU 運算。 通過將參數(shù)寫入 cpu.shares ,即可定義改 cgroup 的 CPU 優(yōu)先級 - 這里是一個相對權(quán)重,而非絕對值 · blkio o block IO 相關(guān)的統(tǒng)計和限制,byte/operation 統(tǒng)計和限制 (IOPS 等),讀寫速度限制等,但是這里主要統(tǒng)計的都是同步 IO ·

18、 devices o 設(shè)備權(quán)限限制 參考文檔:how to use cgroup 二、Docker 安裝 docker 的相關(guān)安裝方法這里不作介紹,具體安裝參考 官檔 獲取當(dāng)前 docker 版本 $ sudo docker versionClient version: 1.3.2Client API version: 1.15Go version (client): go1.3.3Git commit (client): 39fa2fa/1.3.2OS/Arch (client): linux/amd64Server version: 1.3.2Server API version: 1.1

19、5Go version (server): go1.3.3Git commit (server): 39fa2fa/1.3.2三、Docker 基礎(chǔ)用法 Docker HUB : Docker鏡像首頁,包括官方鏡像和其它公開鏡像 因為國情的原因,國內(nèi)下載 Docker HUB 官方的相關(guān)鏡像比較慢,可以使用 鏡像,鏡像保持和官方一致,關(guān)鍵是速度塊,推薦使用。 回到頂部3.1 Search images $ sudo docker search ubuntu回到頂部3.2 Pull images $ sudo docker pull ubuntu # 獲取 ubuntu 官方鏡像 $ sudo

20、docker images # 查看當(dāng)前鏡像列表 回到頂部3.3 Running an interactive shell $ sudo docker run -i -t ubuntu:14.04 /bin/bash· docker run - 運行一個容器 · -t - 分配一個(偽)tty (link is external) · -i - 交互模式 (so we can interact with it) · ubuntu:14.04 - 使用 ubuntu 基礎(chǔ)鏡像 14.04 · /bin/bash - 運行命令 bash shell

21、 注: ubuntu 會有多個版本,通過指定 tag 來啟動特定的版本 image:tag $ sudo docker ps # 查看當(dāng)前運行的容器, ps -a 列出當(dāng)前系統(tǒng)所有的容器 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES6c9129e9df10 ubuntu:14.04 /bin/bash 6 minutes ago Up 6 minutes cranky_babbage回到頂部3.4 相關(guān)快捷鍵 · 退出:Ctrl-Dorexit · detach:Ctrl-P + Ctrl-Q · at

22、tach:docker attach CONTAINER-ID 四、Docker 命令幫助 回到頂部4.1 docker help docker command $ sudo docker # docker 命令幫助Commands: attach Attach to a running container # 當(dāng)前 shell 下 attach 連接指定運行鏡像 build Build an image from a Dockerfile # 通過 Dockerfile 定制鏡像 commit Create a new image from a container's changes

23、 # 提交當(dāng)前容器為新的鏡像 cp Copy files/folders from the containers filesystem to the host path # 從容器中拷貝指定文件或者目錄到宿主機中 create Create a new container # 創(chuàng)建一個新的容器,同 run,但不啟動容器 diff Inspect changes on a container's filesystem # 查看 docker 容器變化 events Get real time events from the server # 從 docker 服務(wù)獲取容器實時事件 exe

24、c Run a command in an existing container # 在已存在的容器上運行命令 export Stream the contents of a container as a tar archive # 導(dǎo)出容器的內(nèi)容流作為一個 tar 歸檔文件對應(yīng) import history Show the history of an image # 展示一個鏡像形成歷史 images List images # 列出系統(tǒng)當(dāng)前鏡像 import Create a new filesystem image from the contents of a tarball # 從t

25、ar包中的內(nèi)容創(chuàng)建一個新的文件系統(tǒng)映像對應(yīng) export info Display system-wide information # 顯示系統(tǒng)相關(guān)信息 inspect Return low-level information on a container # 查看容器詳細(xì)信息 kill Kill a running container # kill 指定 docker 容器 load Load an image from a tar archive # 從一個 tar 包中加載一個鏡像對應(yīng) save login Register or Login to the docker registry

26、 server # 注冊或者登陸一個 docker 源服務(wù)器 logout Log out from a Docker registry server # 從當(dāng)前 Docker registry 退出 logs Fetch the logs of a container # 輸出當(dāng)前容器日志信息 port Lookup the public-facing port which is NAT-ed to PRIVATE_PORT # 查看映射端口對應(yīng)的容器內(nèi)部源端口 pause Pause all processes within a container # 暫停容器 ps List conta

27、iners # 列出容器列表 pull Pull an image or a repository from the docker registry server # 從docker鏡像源服務(wù)器拉取指定鏡像或者庫鏡像 push Push an image or a repository to the docker registry server # 推送指定鏡像或者庫鏡像至docker源服務(wù)器 restart Restart a running container # 重啟運行的容器 rm Remove one or more containers # 移除一個或者多個容器 rmi Remov

28、e one or more images # 移除一個或多個鏡像無容器使用該鏡像才可刪除,否則需刪除相關(guān)容器才可繼續(xù)或 -f 強制刪除 run Run a command in a new container # 創(chuàng)建一個新的容器并運行一個命令 save Save an image to a tar archive # 保存一個鏡像為一個 tar 包對應(yīng) load search Search for an image on the Docker Hub # 在 docker hub 中搜索鏡像 start Start a stopped containers # 啟動容器 stop Stop

29、a running containers # 停止容器 tag Tag an image into a repository # 給源中鏡像打標(biāo)簽 top Lookup the running processes of a container # 查看容器中運行的進(jìn)程信息 unpause Unpause a paused container # 取消暫停容器 version Show the docker version information # 查看 docker 版本號 wait Block until a container stops, then print its exit cod

30、e # 截取容器停止時的退出狀態(tài)值Run 'docker COMMAND -help' for more information on a command.docker option Usage of docker: -api-enable-cors=false Enable CORS headers in the remote API # 遠(yuǎn)程 API 中開啟 CORS 頭 -b, -bridge="" Attach containers to a pre-existing network bridge # 橋接網(wǎng)絡(luò) use 'none'

31、to disable container networking -bip="" Use this CIDR notation address for the network bridge's IP, not compatible with -b # 和 -b 選項不兼容,具體沒有測試過 -d, -daemon=false Enable daemon mode # daemon 模式 -D, -debug=false Enable debug mode # debug 模式 -dns= Force docker to use specific DNS servers

32、# 強制 docker 使用指定 dns 服務(wù)器 -dns-search= Force Docker to use specific DNS search domains # 強制 docker 使用指定 dns 搜索域 -e, -exec-driver="native" Force the docker runtime to use a specific exec driver # 強制 docker 運行時使用指定執(zhí)行驅(qū)動器 -fixed-cidr="" IPv4 subnet for fixed IPs (ex: /16) thi

33、s subnet must be nested in the bridge subnet (which is defined by -b or -bip) -G, -group="docker" Group to assign the unix socket specified by -H when running in daemon mode use '' (the empty string) to disable setting of a group -g, -graph="/var/lib/docker" Path to use a

34、s the root of the docker runtime # 容器運行的根目錄路徑 -H, -host= The socket(s) to bind to in daemon mode # daemon 模式下 docker 指定綁定方式tcp or 本地 socket specified using one or more tcp:/host:port, unix:/path/to/socket, fd:/* or fd:/socketfd. -icc=true Enable inter-container communication # 跨容器通信 -insecure-regist

35、ry= Enable insecure communication with specified registries (no certificate verification for HTTPS and enable HTTP fallback) (e.g., localhost:5000 or /16) -ip="" Default IP address to use when binding container ports # 指定監(jiān)聽地址,默認(rèn)所有 ip -ip-forward=true Enable net.ipv4.ip_forw

36、ard # 開啟轉(zhuǎn)發(fā) -ip-masq=true Enable IP masquerading for bridge's IP range -iptables=true Enable Docker's addition of iptables rules # 添加對應(yīng) iptables 規(guī)則 -mtu=0 Set the containers network MTU # 設(shè)置網(wǎng)絡(luò) mtu if no value is provided: default to the default route MTU or 1500 if no default route is availab

37、le -p, -pidfile="/var/run/docker.pid" Path to use for daemon PID file # 指定 pid 文件位置 -registry-mirror= Specify a preferred Docker registry mirror -s, -storage-driver="" Force the docker runtime to use a specific storage driver # 強制 docker 運行時使用指定存儲驅(qū)動 -selinux-enabled=false Enable

38、selinux support # 開啟 selinux 支持 -storage-opt= Set storage driver options # 設(shè)置存儲驅(qū)動選項 -tls=false Use TLS; implied by tls-verify flags # 開啟 tls -tlscacert="/root/.docker/ca.pem" Trust only remotes providing a certificate signed by the CA given here -tlscert="/root/.docker/cert.pem"

39、Path to TLS certificate file # tls 證書文件位置 -tlskey="/root/.docker/key.pem" Path to TLS key file # tls key 文件位置 -tlsverify=false Use TLS and verify the remote (daemon: verify client, client: verify daemon) # 使用 tls 并確認(rèn)遠(yuǎn)程控制主機 -v, -version=false Print version information and quit # 輸出 docker 版

40、本信息回到頂部4.2 docker search $ sudo docker search -helpUsage: docker search TERMSearch the Docker Hub for images # 從 Docker Hub 搜索鏡像 -automated=false Only show automated builds -no-trunc=false Don't truncate output -s, -stars=0 Only displays with at least xxx stars示例: $ sudo docker search -s 100 ubu

41、ntu # 查找 star 數(shù)至少為 100 的鏡像,找出只有官方鏡像 start 數(shù)超過 100,默認(rèn)不加 s 選項找出所有相關(guān) ubuntu 鏡像 NAME DESCRIPTION STARS OFFICIAL AUTOMATEDubuntu Official Ubuntu base image 425 OK 回到頂部4.3 docker info $ sudo docker info Containers: 1 # 容器個數(shù) Images: 22 # 鏡像個數(shù) Storage Driver: devicemapper # 存儲驅(qū)動 Pool Name: docker-8:17-32212

42、25728-pool Pool Blocksize: 65.54 kB Data file: /data/docker/devicemapper/devicemapper/data Metadata file: /data/docker/devicemapper/devicemapper/metadata Data Space Used: 1.83 GB Data Space Total: 107.4 GB Metadata Space Used: 2.191 MB Metadata Space Total: 2.147 GB Library Version: 1.02.84-RHEL7 (2

43、014-03-26) Execution Driver: native-0.2 # 存儲驅(qū)動 Kernel Version: 3.10.0-123.el7.x86_64Operating System: CentOS Linux 7 (Core) 回到頂部4.4 docker pull && docker push $ sudo docker pull -help # pull 拉取鏡像 Usage: docker pull OPTIONS NAME:TAG Pull an image or a repository from the registry -a, -all-tag

44、s=false Download all tagged images in the repository $ sudo docker push # push 推送指定鏡像 Usage: docker push NAME:TAG Push an image or a repository to the registry示例: $ sudo docker pull ubuntu # 下載官方 ubuntu docker 鏡像,默認(rèn)下載所有 ubuntu 官方庫鏡像 $ sudo docker pull ubuntu:14.04 # 下載指定版本 ubuntu 官方鏡像 $ sudo docker

45、push 00:5000/ubuntu # 推送鏡像庫到私有源可注冊 docker 官方賬戶,推送到官方自有賬戶 $ sudo docker push 00:5000/ubuntu:14.04 # 推送指定鏡像到私有源 回到頂部4.5 docker images 列出當(dāng)前系統(tǒng)鏡像 $ sudo docker images -helpUsage: docker images OPTIONS NAME List images -a, -all=false Show all images (by default filter out the interme

46、diate image layers) # -a 顯示當(dāng)前系統(tǒng)的所有鏡像,包括過渡層鏡像,默認(rèn) docker images 顯示最終鏡像,不包括過渡層鏡像 -f, -filter= Provide filter values (i.e. 'dangling=true') -no-trunc=false Don't truncate output -q, -quiet=false Only show numeric IDs示例: $ sudo docker images # 顯示當(dāng)前系統(tǒng)鏡像,不包括過渡層鏡像 $ sudo docker images -a # 顯示當(dāng)前系

47、統(tǒng)所有鏡像,包括過渡層鏡像 $ sudo docker images ubuntu # 顯示當(dāng)前系統(tǒng) docker ubuntu 庫中的所有鏡像 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEubuntu 12.04 ebe4be4dd427 4 weeks ago 210.6 MBubuntu 14.04 e54ca5efa2e9 4 weeks ago 276.5 MBubuntu 14.04-ssh 6334d3ac099a 7 weeks ago 383.2 MB回到頂部4.6 docker rmi 刪除一個或者多個鏡像 $ sudo dock

48、er rmi -helpUsage: docker rmi IMAGE IMAGE. Remove one or more images -f, -force=false Force removal of the image # 強制移除鏡像不管是否有容器使用該鏡像 -no-prune=false Do not delete untagged parents # 不要刪除未標(biāo)記的父鏡像 回到頂部4.7 docker run $ sudo docker run -helpUsage: docker run OPTIONS IMAGE COMMAND ARG. Run a command in a

49、 new container -a, -attach= Attach to stdin, stdout or stderr. -c, -cpu-shares=0 CPU shares (relative weight) # 設(shè)置 cpu 使用權(quán)重 -cap-add= Add Linux capabilities -cap-drop= Drop Linux capabilities -cidfile="" Write the container ID to the file # 把容器 id 寫入到指定文件 -cpuset="" CPUs in which

50、 to allow execution (0-3, 0,1) # cpu 綁定 -d, -detach=false Detached mode: Run container in the background, print new container id # 后臺運行容器 -device= Add a host device to the container (e.g. -device=/dev/sdc:/dev/xvdc) -dns= Set custom dns servers # 設(shè)置 dns -dns-search= Set custom dns search domains # 設(shè)

51、置 dns 域搜索 -e, -env= Set environment variables # 定義環(huán)境變量 -entrypoint="" Overwrite the default entrypoint of the image # ? -env-file= Read in a line delimited file of ENV variables # 從指定文件讀取變量值 -expose= Expose a port from the container without publishing it to your host # 指定對外提供服務(wù)端口 -h, -host

52、name="" Container host name # 設(shè)置容器主機名 -i, -interactive=false Keep stdin open even if not attached # 保持標(biāo)準(zhǔn)輸出開啟即使沒有 attached -link= Add link to another container (name:alias) # 添加鏈接到另外一個容器 -lxc-conf= (lxc exec-driver only) Add custom lxc options -lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" -m, -memory="" Memory

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論