Search code examples
dockerdocker-registry

Image is not pushed in docker private repository


Docker version 17.03.0-ce on client machine. I am using registry version 2. The machine runs on Ubuntu 16.04 Xenial.

Steps:

  1. I created an image
  2. I created another tag for it of the form <hostname>:5000/<username>/<repository>:<tag>
  3. I executed the command docker push <hostname>:5000/<username>/<repository>:<tag>

Three mentions:

  1. The private repository uses http, not https, as it is mentioned in the error message.
  2. I created a file "docker.json" in the path "/etc/docker", and added the following line: {"insecure-registries": ["<hostname>:5000"] } and executed "sudo /etc/init.d/docker restart"
  3. curl http://<hostname>:5000/v2/_catalog works fine from client machine.

After all these steps, I get the following message:

Get https://<hostname>:5000/v2: http: server gave HTTP response to HTTPS client

Solution

  • I created a file "docker.json" in the path "/etc/docker"

    That's not the correct filename, you need to create a file named /etc/docker/daemon.json. Then rerun the steps you've performed.