- Edit one of the configuration files;
- /etc/default/docker
- DOCKER_OPTS="--insecure-registry yourPublicIP:dockerPort"
- /etc/sysconfig/docker
- OPTIONS="--insecure-registry yourPublicIP:dockerPort"
These are OK as long as they exist or are recognised, and in most cases would apply to the good old sysvinit method.
The way to identify is that you will normally receive the following error message when using your hosts public IP address instead of localhost;
Get https://192.168.0.20:5000/v1/_ping: http: server gave HTTP response to HTTPS client
If you find that neither of the above work after restarting the Docker daemon then try the following solution for those systems using systemd.
- Edit the file /usr/lib/systemd/system/docker.service
- In the file look for the line ExecStart and add to the end of that line the --insecure-registry, e.g. if your host IP is 192.168.0.100 and you map to port 5000
ExecStart=/usr/bin/dockerd --insecure-registry 192.168.0.20:5000
- Save the file
- Tell systemd that you have changed the configuration
sudo systemctl daemon-reload
- Restart your docker daemon
sudo systemctl restart docker
Start your docker containers
You should now be able to push to the public IP address of your server which will forward on to your Docker container running the registry.
This article is based on using https://hub.docker.com/_/registry/ image to run your Private Docker Registry, you will find that unless you create certificates for the service and map the certificate directory you will only be able to use localhost:port/tagName to push your images to the repository. This is due to your Docker daemon running on an SSL port, and the client wanting to make secure connections.
No comments:
Post a Comment