This article brings you relevant knowledge about building a local private warehouse in docker, including using registry images to create private warehouses and checking whether the build is successful and other related issues. I hope it will be helpful to everyone.
docker run -itd --restart always --name docker-hub -p 5000:5000 -v /opt/data/registry:/var/lib/registry registry
View the private warehouse that does not store the image yet, so it is displayed as empty
curl -XGET 127.0.0.1:5000/v2/image_name/tags/list
ifconfig | grep inet
I know that the local IP is 172.17.0.1
docker tag ubuntu:18.04 172.17.0.1:5000/test
2. push image
docker push 172.17.0.1:5000/test
If
Get https://172.17.0.1:5000/v2/: http : server gave HTTP response to HTTPS client
Don’t panic, just change the machine configuration (/etc/docker/daemon.json). First of all, avoid being handicapped. First use cp to back up
cp daemon.json daemon.json.bak
and then change the content of daemon.json
{"insecure-registries":["172.17.0.1:5000"]}
The value of insecure-registries is an iterable list, you can add ip:port by yourself
Remember to change to your own IP and port
systemctl restart docker
docker push 172.17.0.1:5000/test
docker rmi 172.17.0.1:5000/test #将原来push的镜像删掉,方便等会pull检验echo 'DOCKER_OPTS="--insecure-registry 172.17.0.1:5000/test' >> /etc/default/docker
service docker restart #重启服务docker pull 172.17.0.1:5000/test #pull下之前push的镜像
After downloading, you can change the name of the image under pull to facilitate future calls.
docker video tutorial》
The above is the detailed content of How to build a local private warehouse with Docker (detailed example). For more information, please follow other related articles on the PHP Chinese website!