When using mirror registry do we have to prepend the the docker image name with registry name or just with docker image name can I pull the images.
Eg
Consider this image alpine:latest
By default this will pull from docker hub
But when configured mirror registry
Is there any way to pull by just docker pull alpine:latest can this image be pulled from private repos ?
You should be able to do it like this:
Essentially, you need to add "registry-mirrors": []
to the /etc/docker/daemon.json
configuration file. So if you have a mirror hosted at https://my-docker-repo.my.company.com
, your /etc/docker/daemon.json
should contain:
{
"registry-mirrors": ["https://my-docker-repo-mirror.my.company.com"]
}
And then restart docker daemon.
This is telling docker clients that your private repo is a mirror of docker.io so all requests will be sent there, and the images that you would normally get from docker’s registry must all be copied to your private registry.
I have followed this article
and started docker registry
with this command
$ docker run -d -p 5000:5000 --restart always --name registry registry:2
But is there any specific config required in registry container to tell this is a mirror registry.
This is my current config.
/ # cat /etc/docker/registry/config.yml
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
proxies:
default:
remoteurl: https://registry-1.docker.io
{
"registry-mirrors" : [
"https://mirror.gcr.io"
]
}
Using this is also not working docker pull is only pulling from docker.io only
How to pull images from mirror repo
If I am reading this correctly, you are running the docker registry image as a mirror (proxy) to the real docker.io
, right?
In the machines where you want the docker client to read from your registry container, you need to point them to that. Why are you pointing it to mirror.gcr.io
? That’s Google’s mirror, not yours.
And since you are not serving https from that container, you will also have to put it’s address in insecure-registries
{
"registry-mirrors" : [
"http://address-of-your-registry-container:5000"
],
"insecure-registries" : [
"http://address-of-your-registry-container:5000"
],
}
Thanks
but it didn’t worked.
What I meant by using google mirror.gcr.io is when using google mirror registry then also docker is pulling from docker.io only.