Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull Docker from my private docker-registry without specifying the host

I am using docker-registry to pull my own docker images, but I want to do so without the need to specify the host. meanning: instead of writing:

docker pull <host>:<port>/<dockerImage>

I want to write:

docker pull <dockerImage>

and first it will try to pull the docker from my private registry, before trying to pull it from the public docker registry.

Is it possible?

I tried to change the DOCKER_INDEX_URL to [my_docker_registry_host]:[port], but it doesn't work.

like image 922
Muky Avatar asked Aug 06 '14 07:08

Muky


People also ask

How do I pull an image from a private docker repository?

In order to pull images from your private repository, you'll need to login to Docker. If no registry URI is specified, Docker will assume you intend to use or log out from Docker Hub. Triton comes with several images built-in. You can view the available list with triton images .

Where does private docker registry store images?

By default the registry container keep the data in /var/lib/registry within the container. You can bind mount a local directory on your host like the example did -v /mnt/registry:/var/lib/registry ; which in this case the data will be kept on your host at /mnt/registry.


1 Answers

You can modify or add your /etc/sysconfig/docker

ADD_REGISTRY='--add-registry 192.168.0.169:5000'
INSECURE_REGISTRY='--insecure-registry 192.168.0.169:5000'

then modify /etc/systemd/system/docker.service or /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd --registry-mirror=http://192.168.0.169:5000

when you pull a image,docker will pull it from your private registry first,and then docker hub if not found in your private registry.I am working on CentOS 7 Docker 1.12.

like image 96
pigletfly Avatar answered Oct 19 '22 22:10

pigletfly