0

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 2

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.

2
  • But there is no daemon,json on the client server on that directory, should I create the file? I'll try.
    – yatta
    Apr 23, 2022 at 20:42
  • 1
    If the file doesn't exist yet then you can create it. Actually I think it typically doesn't exist initially.
    – Rafał G.
    Apr 23, 2022 at 20:44
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.