I have a docker 1.12 running on CentOS. I am trying to add insecure registry to it and things mentioned in documentation just don\'t work. The system uses systemd
For me the solution was to add the registry to here:
/etc/sysconfig/docker-registries
DOCKER_REGISTRIES=''
DOCKER_EXTRA_REGISTRIES='--insecure-registry b.example.com'
If you already have a config.json file then the final file should look something like this...
Here registry.myprivate.com
is the one which was giving me problems.
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "xxxxxxxxxxxxxxxxxxxx=="
},
"registry.myprivate.com": {
"auth": "xxxxxxxxxxxxxxxxxxxx="
}
},
"HttpHeaders": {
"User-Agent": "Docker-Client/19.03.8 (linux)"
},
"insecure-registries" : ["registry.myprivate.com"]
}
Creating /etc/docker/daemon.json file and adding the below content and then doing a docker restart on CentOS 7 resolved the issue.
{
"insecure-registries" : [ "hostname.cloudapp.net:5000" ]
}
The solution with the /etc/docker/daemon.json
file didn't work for me on Ubuntu.
I was able to configure Docker insecure registries on Ubuntu by providing command line options to the Docker daemon in /etc/default/docker
file, e.g.:
# /etc/default/docker
DOCKER_OPTS="--insecure-registry=a.example.com --insecure-registry=b.example.com"
The same way can be used to configure custom directory for docker images and volumes storage, default DNS servers, etc..
Now, after the Docker daemon has restarted (after executing sudo service docker restart
), running docker info
will show:
Insecure Registries:
a.example.com
b.example.com
127.0.0.0/8
I happened to encounter a similar kind of issue after setting up local internal JFrog Docker Private Registry on Amazon Linux.
THE followings I did to solve the issue:
Added "--insecure-registry xx.xx.xx.xx:8081" by modifying the OPTIONS variable in the /etc/sysconfig/docker file:
OPTIONS="--default-ulimit nofile=1024:40961 --insecure-registry hostname:8081"
Then restarted the docker.
I was then able to login to the local docker registry using:
docker login -u admin -p password hostname:8081
(Copying answer from question)
To add an insecure docker registry, add the file /etc/docker/daemon.json
with the following content:
{
"insecure-registries" : [ "hostname.cloudapp.net:5000" ]
}
and then restart docker.