Environment preparation
- Use two machines, one to do Docker private warehouse, one to do Docker image submission
- Make sure Docker is installed on both machines and start the Docker service
- The name of the Docker private warehouse is: Docker-registry, IP: 192.168.1.101
- The Docker image is submitted with the name: Docker-app, IP 192.168.1.102
Installation of private warehouses and push of mirrors
- Execute the following command on the Docker-registry machine:
docker run --name docker-registry -d -p 5000:5000 registry
Change the contents of the/etc/default/docker file on the Docker-app machine:
DOCKER_OPTS="--insecure-registry 192.168.1.101:5000 --dns 114.114.114.114"
Modify the/lib/systemd/system/docker.service file to support the modified Docker configuration file to use the HTTP protocol
EnvironmentFile=-/etc/default/dockerExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS
- Reload Docker service and restart Docker service
- Pull an image on the Docker-app machine, such as Nginx or Tomcat
- Then look at the ID of the image
- Use this image as a marker for push
docker tag IMAGE_ID 192.168.1.101:5000/nginx
Then push to the warehouse:
docker push 192.168.1.101:5000/nginx
- To see if it was successful:
curl -X GET http://192.168.1.101:5000/v2/_catalog
- Delete Local Image:
docker rmi tomcat 192.168.1.101:5000/tomcat
- To run the image of a private warehouse on Docker-app:
docker run --name nginx01 -p 80:80 -idt 192.168.1.101:5000/nginx
Docker private repository under Linux