skip to Main Content

I installed a Docker registry to my server like below;

docker run -d -p 5000:5000 --name registry registry:2

So after that I pushed Alpine image to that registry.

docker pull alpine
docker image tag alpine localhost:5000/alpinetest
docker push localhost:5000/alpinetest

So the problem is I want to access this image from another server.

So I can run the command below from client to Docker registry’s server;

user@clientserver ~
$ curl 10.10.2.18:5000/v2/_catalog
{"repositories":["alpinetest"]}

So how can I pull this "Alpinetest" image from another "clientserver"?

For example the command below is not working;

user@clientserver ~
$ docker pull 10.10.2.18:5000/alpinetest:latest
Using default tag: latest
Error response from daemon: Get "https://10.10.2.18:5000/v2/": http: server gave HTTP response to HTTPS client

Thanks!

2

Answers


  1. On the machine that wants to pull the image, create or edit /etc/docker/daemon.json and enter this:

    {
      "insecure-registries": ["10.10.2.18:5000"]
    }
    

    and then run:

    sudo systemctl restart docker
    

    Just be aware that the registry is, just like it says, insecure. This setup shouldn’t be used when the registry is accessed over the internet or in any other environment that you don’t have full control over. But it’s definitely nice for local tests.

    Login or Signup to reply.
  2. I don’t know why I can’t restart docker daemon after creating /etc/docker/daemon.json file. But I got a hint from this manual and could enroll my private registry as an insecure registry for docker.

    #If the directory does not exist, create it with mkdir command.
    cd /etc/systemd/system/docker.service.d 
    sudo vi docker-options.conf
    

    And add environment variable to the daemon.

    Environment="DOCKER_OPTS=--insecure-registry=<your.registry:port>"
    

    Flush changes and restart the daemon.

    sudo systemctl daemon-reload
    sudo systemctl restart docker
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search