Add Insecure Registry to Docker

+1 vote

I have a docker 1.12 running on CentOS. I am trying to add 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 ?

Aug 1, 2018 in Docker by Hannah
• 14,080 points
1,667 views

2 answers to this question.

0 votes

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.

answered Aug 1, 2018 by Kalgi
• 37,430 points
+1 vote

I added into /etc/default/docker file

DOCKER_OPTS="--insecure-registry <myip>:5000"

I edited that line with FQDN, IP address, --insecure-registry=<myip>:5000, and--insecure-registry http://<myip>:5000

answered Apr 26 by Hitesh

Related Questions In Docker

0 votes
1 answer

Docker: Add a restart policy to a container that was already created

In recent versions of docker (as of ...READ MORE

answered Jul 30, 2018 in Docker by Kalgi
• 37,430 points
39 views
0 votes
1 answer

How to push a docker image onto the Azure Container Registry (ACR)?

Before pushing local Docker image to ACR, ...READ MORE

answered Jul 4 in Docker by Sirajul
• 6,120 points
21 views
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,100 points

edited Oct 16, 2018 by lina 3,264 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,160 points
101 views
+1 vote
11 answers

How to run multiple commands in docker at once?

Try this: docker run image bash -c "cd ...READ MORE

answered Apr 17 in Docker by anonymous

edited Apr 17 by Kalgi 12,141 views
+1 vote
4 answers