Docker私有仓库管理

docker load -i registry.tar.gz    
docker run -d -p 5000:5000 --restart=always --name registry -v /opt/myregistry:/var/lib/registry  registry
docker tag kode:v2 10.0.0.11:5000/kode:v2   给kode:v2打上标签

[root@docker1 centos_zabbix]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
10.0.0.11:5000/kode             v2                  6914fda5fd44        About an hour ago   502MB
kode                            v2                  6914fda5fd44        About an hour ago   502MB
[root@docker1 centos_zabbix]# cat /etc/docker/daemon.json
{
  "registry-mirrors": ["https://registry.docker-cn.com"],
  "insecure-registries": ["10.0.0.11:5000"]  这条是支持http协议,默认只支持https协议
}

[root@docker1 centos_zabbix]# systemctl restart docker
[root@docker1 centos_zabbix]# docker push 10.0.0.11:5000/kode:v2
The push refers to repository [10.0.0.11:5000/kode]
8cfef2e89511: Pushed
d91e224377a7: Pushed
f62f360c3707: Pushed
f8a07a9524ca: Pushed
3e9b714f4415: Pushed
64d86423e2e3: Pushed
a1ca40978f2f: Pushed
b5e11aae8a8e: Pushed
v2: digest: sha256:bba86d3ebe28f028fbe746e2cd0fc59bed9aa7b369bdcccec42088e91407b837 size:1993

 

 页面测试:

 

查看版本:

[root@docker1 centos_zabbix]# docker tag busybox:latest 10.0.0.11:5000/busybox:latest
[root@docker1 centos_zabbix]# docker push 10.0.0.11:5000/busybox:latest
The push refers to repository [10.0.0.11:5000/busybox]
6194458b07fc: Pushed
latest: digest: sha256:bf510723d2cd2d4e3f5ce7e93bf1e52c8fd76831995ac3bd3f90ecc866643aff size: 527

  

 下载镜像:

[root@docker2 ~]# cat /etc/docker/daemon.json
{
"insecure-registries": ["10.0.0.11:5000"]
}
之后重启docker,并下载镜像:
[root@docker2 ~]# docker run -d -p 80:80 10.0.0.11:5000/kode:v2    这里是可以直接运行,但是需要先下载镜像
Unable to find image '10.0.0.11:5000/kode:v2' locally
v2: Pulling from kode
993c50d47469: Already exists
e96bb0f2ed55: Pull complete
95647a6b9915: Pull complete
1d780b852b28: Pull complete
15caef2b2cf8: Pull complete
da519f134b0b: Pull complete
831074bbccbf: Pull complete
2662dec0af9c: Pull complete
Digest: sha256:bba86d3ebe28f028fbe746e2cd0fc59bed9aa7b369bdcccec42088e91407b837
Status: Downloaded newer image for 10.0.0.11:5000/kode:v2
6ed4f35cb60e09f753ba94566d7e529565e07a2a07239d3790718ba6919b23c5
[root@docker2 ~]# docker ps -a
CONTAINER ID        IMAGE                    COMMAND                CREATED             STATUS         PORTS                NAMES
6ed4f35cb60e        10.0.0.11:5000/kode:v2   "/bin/bash /init.sh"   4 seconds ago       Up 3 seconds        0.0.0.0:80->80/tcp   jovial_heisenberg

打开网页测试:

  

猜你喜欢

转载自www.cnblogs.com/nsh123/p/11137806.html