首先拉取registry镜像,官方的registry镜像不支持arm,但是有人提供了适合树莓派的registry镜像
docker pull budry/registry-arm
创建存储仓库的目录
mkdir dockerregistry
运行容器(容器启动就运行)
docker run --name registry-arm -d -p 5000:5000 -v /home/dockerregistry:/var/lib/registry --restart always budry/registry-arm
docker pull tomcat
给这个镜像重新命名
docker tag tomcat 192.168.3.9:5000/tomcat
之后push到仓库
docker push 192.168.3.9:5000/tomcat
vim /etc/docker/deamon.json
{
"registry-mirrors": [""],
"insecure-registries": ["192.168.3.9:5000"]
}
我在redhat上拉取镜像出现这个问题
docker pull 192.168.3.9:5000/tomcat
Error response from daemon: invalid registry endpoint https://10.52.64.117:5000/v0/: unable to ping registry endpoint https://10.52.64.117:5000/v0/
v2 ping attempt failed with error: Get https://10.52.64.117:5000/v2/: tls: oversized record received with length 20527
v1 ping attempt failed with error: Get https://10.52.64.117:5000/v1/_ping: tls: oversized record received with length 20527. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add --insecure-registry 10.52.64.117: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/10.52.64.117:5000/ca.crt
解决方案
vim /etc/sysconfig/docker
增加红色框内容重启即可解决
主要原因是搭建的私服不支持https,但是客户端默认使用https
其他平台可以试试下边解决方法
vim /usr/lib/systemd/system/docker.service
增加–insecure-registry XXXX:5000
重启