瀏覽標籤:

架設

如何建立私人的 docker registry 架設教學 (一)

一、建立自己的 docker registry 主機

參考docker registry 來源:https://hub.docker.com/_/registry

環境:CentOS 7

  • Docker-Registry:私倉主機(docker-registry.com.cc:5000)
  • nginx:連線至Docker_Registry主機進行 image push 流程

Docker-Registry主機上執行指令docker run -d -p 5000:5000 -v /home/docker-registry/storage:/var/lib/registry --name registry registry:latest

[root@Docker-Registry ~]# docker run -d -p 5000:5000 -v /home/docker-registry/storage:/var/lib/registry --name registry registry:latest
Unable to find image 'registry:latest' locally
Trying to pull repository docker.io/library/registry ... 
latest: Pulling from docker.io/library/registry
cbdbe7a5bc2a: Pull complete 
47112e65547d: Pull complete 
46bcb632e506: Pull complete 
c1cc712bcecd: Pull complete 
3db6272dcbfa: Pull complete 
Digest: sha256:8be26f81ffea54106bae012c6f349df70f4d5e7e2ec01b143c46e2c03b9e551d
Status: Downloaded newer image for docker.io/registry:latest
4c8c0b3e0981716be24d49c360a46c38ccdeaafd9f52ee541a250e8154f17941

指令說明:

-d 背景執行
-p 5000:5000 使用5000 port
-v 將本地的 /home/docker-registry/storage 關連至 /var/lib/registry
–name docker令名,可自定
registry:latest 取得docker hub 上 registry 最新的版本

建立完成後,可執行 docker ps -a 查看是否正常運行

[root@Docker-Registry ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
4c8c0b3e0981        registry:latest     "/entrypoint.sh /e..."   18 minutes ago      Up 18 minutes       0.0.0.0:5000->5000/tcp   registry
閱讀更多