Start your registry
docker run -d -p 5000:5000 --name registry registry:2
Pull (or build) some image from the hub
docker pull ubuntu
Tag the image so that it points to your registry
docker image tag ubuntu localhost:5000/myfirstimage
Push it
docker push localhost:5000/myfirstimage
Pull it back
docker pull localhost:5000/myfirstimage
Now stop your registry and remove all data
docker container stop registry && docker container rm -v registry查看注册了哪些镜像
访问:http://localhost:5000/v2/_catalog
用 Dockerfile 构建、发布原文点击这里
普通推送:
docker tag image1 uid/image:1.0 docker push uid/image:1.0 docker tag image1 uid/image docker push uid/image
使用本地仓库:
docker tag image2 localhost:5000/image:2.0 docker push localhost:5000/image:2.0 docker tag image2 localhost:5000/image docker push localhost:5000/image常见问题
- 由于启动的 registry 服务不是安全可信赖的,在其他服务器上推送会显示:
$ docker push 10.1.2.9:5000/test Using default tag: latest The push refers to repository [10.1.2.9:5000/test] Get "https://10.1.2.9:5000/v2/": http: server gave HTTP response to HTTPS client
a. 这时需要修改客户端的 Docker 引擎配置文件来信任这个仓库。修改客户端配置文件 /etc/docker/daemon.json,如果没有该文件或文件夹需手动进行创建。在文件中添加 insecure-registries,内容为 registry 的服务地址:(重启后生效)
// 客户端配置文件
{
"registry-mirrors": [ "https://pee6w651.mirror.aliyuncs.com"],
"insecure-registries": ["registry所在的ip地址:5000"]
}



