宜蘭縣教育支援平台 會員登入 會員註冊 我的i教書

« 上一篇 | 下一篇 »

參考網站:
用ESXi建Photon OS虛擬機 打造超輕量Docker環境 - 專題報導 - 網管人NetAdmin
Basic Commands for VMware Photon and Docker | Virten.net

1. 執行內建的 Nginx 網站
連上網路下載
-d 以 Daemonized 形式執行
# docker run -d -p 80:80 vmwarecna/nginx
Unable to find image 'vmwarecna/nginx:latest' locally
latest: Pulling from vmwarecna/nginx
a3ed95caeb02: Pull complete
b6f2388a20dd: Pull complete
a305e4b888ce: Pull complete
80596a504ef3: Pull complete
99c028eff2a4: Pull complete
a1cee46bc434: Pull complete
9bd9868012b9: Pull complete
6fa7100a2613: Pull complete
Digest: sha256:f73bbae0f31823c06478b1fa5efb4957bc25239802fd5ea94e4442c0a6090d23
Status: Downloaded newer image for vmwarecna/nginx:latest
085923c591c6b63b477d3267e4f42945a02ea8ebf828e030740b4c299f0e6d57

執行之後,會新增 docker0 網路介面
# ifconfig docker0
docker0   Link encap:Ethernet  HWaddr 02:42:fa:50:60:86
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:faff:fe50:6086/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:69 errors:0 dropped:0 overruns:0 frame:0
          TX packets:90 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:101690 (101.6 KB)  TX bytes:7392 (7.3 KB)

防火牆部分也會新增規則
# iptables -L DOCKER -n
Chain DOCKER (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  0.0.0.0/0            172.17.0.2           tcp dpt:80

2. 開啟瀏覽器,輸入 Photon OS IP


3. Docker 版本
# docker version
Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Wed Apr 13 19:36:04 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Wed Apr 13 19:36:04 2016
 OS/Arch:      linux/amd64

#Download a Docker container (https://registry.hub.docker.com/)
docker pull vmwarecna/nginx

#Display local stored Docker images
docker images

#Start Docker Container
# -d       - Run the container in the background
# -p 80:80 - Publish the container's port to the host
docker run -d -p 80:80 vmwarecna/nginx

#List running Docker Containers
docker ps

#Display the public-facing port that is NAT-ed to the container
#(Container ID from docker ps command)
docker port 5f6b0e03c6de

#Stop Docker Container
docker stop 5f6b0e03c6de

#Automatically start Docker containers at boot time
#To start a container at boot time the restart policy parameter is used. 
docker run --restart=always -d -p 80:80 vmwarecna/nginx

如果你的網誌不支援引用網址自動搜尋功能,那麼你可以使用下列的直接引用網址來引用本文章:

http://blog.ilc.edu.tw/blog/trackback.php?id=690263