31-docker registry仓库配置

1.官方registry仓库

[root@docker01 /]# docker run -d --name registry -p 5000:5000 registry
Unable to find image 'registry:latest' locally
latest: Pulling from library/registry
4064ffdc82fe: Pull complete 
c12c92d1c5a2: Pull complete 
4fbc9b6835cc: Pull complete 
765973b0f65f: Pull complete 
3968771a7c3a: Pull complete 
Digest: sha256:51bb55f23ef7e25ac9b8313b139a8dd45baa832943c8ad8f7da2ddad6355b3c8
Status: Downloaded newer image for registry:latest
5a8cf1fd715a040d26342a26b0e485250e8afcd22c6c65936f103789be2ffd42

 2.默认是https,需要更新docker的http

[root@docker01 /]# vim /etc/docker/daemon.json

{
  "registry-mirrors": ["https://tdimi5ql.mirror.aliyuncs.com"],
  "insecure-registries": ["http://192.168.1.23:5000"]
}

 3.变更了docker,需要重启docker

[root@docker01 /]# systemctl restart docker
[root@docker01 /]# docker start registry
registry
[root@docker01 /]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
5a8cf1fd715a        registry            "/entrypoint.sh /etc…"   6 minutes ago       Up 11 seconds       0.0.0.0:5000->5000/tcp   registry
[root@docker01 /]# 

 4.dokcer容器打上远程镜像标记

[root@docker01 docker]# docker tag app/jenkins 192.168.1.23:5000/app/jenkins
[root@docker01 docker]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
192.168.1.23:5000/app/jenkins   latest              35a49983359e        2 hours ago         603MB
app/jenkins                     latest              35a49983359e        2 hours ago         603MB
system/centos                   v4                  57bce9eea5a5        2 hours ago         528MB
system/centos                   v3                  acb5e563c415        3 hours ago         307MB
system/centos                   v2                  c2e7da62bc5f        4 hours ago         303MB
system/centos                   v1                  716f4a675d71        4 hours ago         298MB
registry                        latest              b2b03e9146e1        8 days ago          33.3MB
nginx                           latest              3c5a05123222        8 days ago          109MB
centos                          latest              49f7960eb7e4        5 weeks ago         200MB

 5.上传容器镜像到仓库

[root@docker01 docker]# docker push 192.168.1.23:5000/app/jenkins
The push refers to repository [192.168.1.23:5000/app/jenkins]
48ed63ff7606: Pushed 
b3a55f87e5c0: Pushed 
2d3f980e73a6: Pushed 
3fb6cfb76a22: Pushed 
1afb9706632a: Pushed 
cb1b815e8c65: Pushed 
82356941e9cc: Pushed 
62384df37f6a: Pushed 
9a26c33e30ef: Pushed 
34e8737830f2: Pushed 
cd6b212e530b: Pushed 
91dbd810c64b: Pushed 
452ad9cf0df1: Pushed 
bcc97fbfc9e1: Pushed 
latest: digest: sha256:3c86664aa032a7f17f892fa22b35b5b4e225165f850dbc8ad3726b1c415a1a32 size: 3246

 

posted @ 2018-07-15 19:47  sunmmi  阅读(269)  评论(0)    收藏  举报