Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+9 votes
6 views
in DevOps and Agile by (50.2k points)

I have a docker 1.12 running on CentOS. I am trying to add an insecure registry to it. The system uses systemd so I created a /etc/systemd/system/docker.service.d/50-insecure-registry.conf file.

$ cat /etc/systemd/system/docker.service.d/50-insecure-registry.conf

[Service]

Environment='DOCKER_OPTS=--insecure-registry="hostname.cloudapp.net:5000"'

After loading daemon and restarting docker service, systemd shows that the environment variable is there

$ sudo systemctl show docker | grep Env

Environment=DOCKER_OPTS=--insecure-registry="hostname.cloudapp.net:5000"

But when I run docker info I don't see that insecure registry added

$ docker info

........

Registry: https://index.docker.io/v1/

WARNING: bridge-nf-call-iptables is disabled

WARNING: bridge-nf-call-ip6tables is disabled

Insecure Registries:

    127.0.0.0/8

Pushing images to hostaneme.cloudapp.net fails with

Pushing application     (hostname.cloudapp.net:5000/application:latest)...

The push refers to a repository     [hostname.cloudapp.net:5000/mozart_application]

ERROR: Get https://hostname.cloudapp.net:5000/v1/_ping: http: server gave HTTP response to HTTPS client

Is there something that could be done? Am I missing something?

1 Answer

+10 votes
by (107k points)

You can add an insecure Docker registry by adding the file /etc/docker/daemon.json with the following content:

{

"insecure-registries":["hostname.cloudapp.net:5000" ]

}

and then restart the docker.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...