docker-搭建私服仓库并推送镜像到私服仓库


安装私有仓库

拉取镜像

docker pull registry

将镜像启动

docker  run -d -p 5000:5000  registry

查看私服上的镜像

 curl -XGET http://127.0.0.1:5000/v2/_catalog

将仓库地址添加到docker

[root@localhost ~]# vim /etc/docker/daemon.json
[root@localhost ~]# cat /etc/docker/daemon.json
{
  "registry-mirrors": ["https://3dcko41g.mirror.aliyuncs.com"],
 "insecure-registries":["127.0.0.1:5000"]
}

重启docker

service docker restart

推送镜像

将修改后的容器制作为镜像

 docker commit -m="msg" -a="tlj"  c10659b0e25c  myzoo:1.2

给镜像加上tag

Usage:  docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG] 

docker tag myzoo:1.2 127.0.0.1:5000/myzoo:1.2

推送到私有仓库

Usage:  docker push [OPTIONS] NAME[:TAG]

Push an image or a repository to a registry

Options:
  -a, --all-tags                Push all tagged images in the repository
      --disable-content-trust   Skip image signing (default true)
  -q, --quiet                   Suppress verbose output

 docker push 127.0.0.1:5000/myzoo:1.2