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
• 18,520 points
12,562 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
• 52,350 points
Thank you !!
it worked for me.
+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, 2019 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
• 52,350 points
1,606 views
0 votes
1 answer
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, 2019 in Docker by Sirajul
• 59,230 points
5,582 views
0 votes
1 answer

How to add one worker node to the Docker swarm?

Hi@akhtar, You will get one token when you ...READ MORE

answered Dec 24, 2020 in Docker by MD
• 95,460 points
1,206 views
+2 votes
1 answer
+2 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
• 58,020 points
2,737 views
0 votes
2 answers
+1 vote
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP