你可以先搜尋所需的image,所用的指令如下
root@ubuntu:~# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 1749 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 410 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 103 [OK]
maxexcloo/nginx-php Docker framework container with Nginx and ... 51 [OK]
million12/nginx-php Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS... 30 [OK]
h3nrik/nginx-ldap NGINX web server with LDAP/AD, SSL and pro... 17 [OK]
bitnami/nginx Bitnami nginx Docker Image 7 [OK]
maxexcloo/nginx Docker framework container with Nginx inst... 6 [OK]
million12/nginx Nginx: extensible, nicely tuned for better... 4 [OK]
devries/nginx A standard ubuntu nginx installation with ... 4 [OK]
radial/nginx Spoke container for Nginx, a high performa... 1 [OK]
desertbit/nginx Deploy Nginx with some useful presets avai... 1 [OK]
abevoelker/nginx nginx 1 [OK]
boomtownroi/nginx An nginx container with consul support 1 [OK]
klaemo/nginx nginx 1.7.0 (mainline) 1 [OK]
dock0/nginx Arch container running nginx 1 [OK]
1science/nginx Nginx Docker images based on Alpine Linux 1 [OK]
unblibraries/nginx Baseline non-PHP nginx container 0 [OK]
aegypius/nginx confd managed nginx reverse proxy 0 [OK]
verbling/nginx configured nginx container 0 [OK]
webdevops/nginx Nginx container 0 [OK]
c4tech/nginx Several nginx images for web applications. 0 [OK]
pathwar/nginx Nginx template for Pathwar levels 0 [OK]
mariorez/nginx Base Container for Nginx 0 [OK]
funkygibbon/nginx nginx + openssl automated build, customisa... 0 [OK]
從中選擇一個你需要的,再來進行下載,以第一個Official build of Nginx為例,指令如下
root@ubuntu:~# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
1565e86129b8: Pull complete
a604b236bcde: Pull complete
84cef7523477: Pull complete
fd07be91d48e: Pull complete
fb36adbd81bf: Pull complete
097ca86c0784: Pull complete
8e0912ce0c1b: Pull complete
306fa48b674e: Pull complete
e51a2e0cfd66: Pull complete
8ccac0b28146: Pull complete
20ea32821467: Pull complete
198a73cfd686: Pull complete
Digest: sha256:a3e3180ab6ac4a3095cf6d6225223e10fa5f5ac1b20939a4ba1d777918f63f9f
Status: Downloaded newer image for nginx:latest
列出主機上可用的images,指令如下,可以看到剛剛下載的那個image
root@ubuntu:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
nginx latest 198a73cfd686 10 days ago 132.8 MB
使用nginx image來啟動一個container
root@ubuntu:~# docker run --name mynginx -v /usr/local/nginxHome:/usr/share/nginx/html:ro -d -p 8080:80 nginx
c14f721ac52e591cd80a31e67405893360cf8c80b61ce33fa0beec2bd217e752
使用ps來看看是否有啟動,真的有東西耶
root@ubuntu:~# ps -ef|grep nginx
root 3064 2794 0 14:25 ? 00:00:00 nginx: master process nginx -g daemon off;
sshd 3087 3064 0 14:25 ? 00:00:00 nginx: worker process
root 3094 2938 0 14:28 pts/0 00:00:00 grep --color=auto nginx
文章標籤
全站熱搜
留言列表