Home > Net >  Pulling an image from local Docker registry
Pulling an image from local Docker registry

Time:04-24

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!

CodePudding user response:

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.

  • Related