Search code examples
registrydockerprivate

Docker - Unable to push image to private registry


I have created my own private registry on my server by pulling and running the registry image.

sudo docker run -d -p 5000:5000 registry

After which, I tried to tag a simple image and push it to the server.

sudo docker tag ubuntu:latest localhost:5000/myprivateubuntu

And I received this error:

Error: Invalid registry endpoint ... Get ... If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add '--insecure-registry localhost: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/localhost:5000/ca.crt

Anyhow know what's the problem?


Solution

  • stop the service.

    sudo service docker stop
    

    restart service with --insecure-registry arguments:

    /usr/bin/docker -d --insecure-registry localhost:5000
    

    or edit /etc/default/docker file and add the following line:

    DOCKER_OPTS="--insecure-registry localhost:5000"