centos6搭建docker镜像私服
1、创建私服容器
docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /opt/data/registry:/tmp/registry -p 5000:5000 registry
2、修改/etc/sysconfig/docker配置文件
如果不修改这个配置文件,则上传镜像时会出现如下错误
Error: v1 ping attempt failed with error: Get https://192.168.1.230:5000/v1/_ping: dial tcp 192.168.1.230:5000: connection refused. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 192.168.1.230:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/192.168.1.230:5000/ca.crt
修改之后的配置文件如下:
other_args="--selinux-enabled --insecure-registry 192.168.1.230:5000"
3、重启docker服务
service docker restart
4、查看私服上所有的镜像
curl -X GET http://192.168.1.230:5000/v1/search
5、从官方下载镜像
docker pull hello-world
6、给镜像加上标签
如果不加标签,则上传镜像时会提示没有hello-world这个库
docker tag hello-world 192.168.1.230:5000/hello-world
7、上传到私服
docker push 192.168.1.230:5000/hello-world
8、从私服上下载镜像
docker pull 192.168.1.230:5000/hello-world
9、删除私服上的镜像
目前还没有办法删除镜像