1. 程式人生 > >docker構建私有倉庫

docker構建私有倉庫

1.在原有的docker服務基礎上,下拉一個 registry 映象:

docker pull registry:2.6.2

2.執行:

docker run -d -p 5000:5000 --restart=always --name registry registry:2.6.2

 3.將自己的映象推送到私有倉庫:

    例如:docker.io/langwanghuangshifu/eureka-server:latest

docker push localhost:5000/langwanghuangshifu/eureka-server:latest

    執行提示:

    The push refers to a repository [localhost:5000/langwanghuangshifu/eureka-server]
    An image does not exist locally with the tag: localhost:5000/langwanghuangshifu/eureka-server

    此時,會發現推送失敗,由於docke hub 為預設的映象倉庫,推送命令實質上為:docker push docker.io/langwanghuangshifu/eureka-server:latest

    因此需要將上述映象更改映象標籤:

docker tag langwanghuangshifu/eureka-server:latest localhost:5000/langwanghuangshifu/eureka-server:latest

    再次執行:

docker push localhost:5000/langwanghuangshifu/eureka-server:latest

    推送成功: