和Docker Hub或映像檔資料庫相關的指令就3個,分別如下:
Docker的元件中,最重要的就是官方的Docker Hub,充滿了全世界的大公司的、個人、玩家自製的Docker映像檔。你當然也可以貢獻自製的映像檔,只要到Docker的官方雲端映像檔資料庫註冊帳號即可。
註冊完之後,在本機可以使用帳號密碼登入,以便之後的映像檔上傳等。
$ docker login
Username: joshhu
Password:
Email: [email protected]
Login Succeeded
如果你有自行架設私有的Docker映像檔資料庫,則輸入該資料庫的位址,如:
docker login 192.168.1.100:8000
一般如果在login/logout
後方留空,則自動指向公有的docker hub,https://index.docker.io/v1/。
注意-正常使用不需要帳號密碼
一般使用Docker的映像檔時,是完全不需要帳號密碼的,只有要上傳映像檔才需要。
這個指令是在Docker Hub找中尋找映像檔用的。最好用的就是-s
參數,用來找評等較高(星級)的映像檔。由於Docker Hub是人人可上傳的,因此映像檔的品質參差不齊。查看大家評等較高的映像檔,品質較有口碑。舉例來說,nginx
的映像檔一定有一大堆,我們可以找出星級在100以上的,輸入:
$ docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 706 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 166 [OK]
maxexcloo/nginx-php Docker framework container with Nginx and ... 30 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 12 [OK]
marvambass/nginx-registry-proxy Docker Registry Reverse Proxy with Basic A... 12 [OK]
million12/nginx-php Nginx + PHP-FPM, CentOS-7 based. 6 [OK]
maxexcloo/nginx Docker framework container with Nginx inst... 5 [OK]
zenithar/nano-nginx Nano NGiNX Container, compiled from scratch. 5 [OK]
dylanlindgren/docker-nginx Docker image for Nginx, to be used in comb... 5 [OK]
h3nrik/nginx-ldap NGINX web server with LDAP/AD, SSL and pro... 4 [OK]
million12/nginx Nginx: extensible, nicely tuned for better... 2 [OK]
devries/nginx A standard ubuntu nginx installation with ... 2 [OK]
abevoelker/nginx nginx 1 [OK]
klaemo/nginx nginx 1.7.0 (mainline) 1 [OK]
radial/nginx Spoke container for Nginx, a high performa... 1 [OK]
rnbwd/nginx fork of jwilder/nginx-proxy with spdy 1 [OK]
dperson/nginx 1 [OK]
jakexks/tiny-nginx Tiny (under 7MB!) nginx 1.6.2 container, b... 1 [OK]
dock0/nginx Arch container running nginx 0 [OK]
densuke/nginx-php5 NginxとPHP5を使えるように調整し... 0 [OK]
aegypius/nginx confd managed nginx reverse proxy 0 [OK]
abcum/nginx Docker container for nginx 0 [OK
會有一大堆,但如果輸入:
$
$ docker search -s 10 nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 706 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 166 [OK]
maxexcloo/nginx-php Docker framework container with Nginx and ... 30 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 12 [OK]
marvambass/nginx-registry-proxy Docker Registry Reverse Proxy with Basic A... 12 [OK]
$
這樣的搜索結果精準多了,我們也會發現,通常由軟體發行公司提供的官方映像檔品質一定最好。