12

As we all known, we can add one --insecure-registry to the /etc/default/docker config file to allow insecure registry, like this:

DOCKER_OPTS="$DOCKER_OPTS --insecure-registry myregistry:5000"

My question is: Does it support adding more than one --insecure-registry since we need to communicate with more than one registries ?

mainframer
  • 20,411
  • 12
  • 49
  • 68

4 Answers4

23

You can specify multiple insecure registries by lining them up:

--insecure-registry IP1:PORT --insecure-registry IP2:PORT --insecure-registry IP3:PORT

Source: https://github.com/docker/docker/issues/9026

michaelbahr
  • 4,837
  • 2
  • 39
  • 75
  • 3
    Is there a way to tell docker to allow any insecure registry without having to enumerate each one? – Frak Apr 27 '20 at 18:07
  • 2
    @frakman1 This parameter accepts CIDR notation as well, so "--insecure-registry 0.0.0.0/1 --insecure-registry 128.0.0.0/1" should cover it. For obvious reasons, this is not recommended. See https://docs.docker.com/engine/reference/commandline/dockerd/#insecure-registries for more information to insecure registries. – marcelbrueckner Mar 05 '22 at 14:02
10

Docker 17.xx +

  1. Edit the daemon.json file, whose default location is /etc/docker/daemon.json on Linux or C:\ProgramData\docker\config\daemon.json on Windows Server

    If the daemon.json file does not exist, create it.

    {
          "insecure-registries": ["myregistry:5000", "anotherregistry:5000"]
    }
    
  2. Restart Docker for the changes to take effect. In Ubuntu would be like this:

    $ sudo systemctl daemon-reload
    $ sudo systemctl restart docker
    

Find more details in official documentation page https://docs.docker.com/registry/insecure/

Camilo Silva
  • 8,283
  • 4
  • 41
  • 61
0

If you are using docker on RHEL,CentOS,Fedora etc

(you can configure the same in Ubuntu but it's int another location)

you can add the next line in the docker service /etc/sysconfig/docker

INSECURE_REGISTRY='--insecure-registry IP1:PORT1 --insecure-registry IP2:PORT2'

save the file and restart the docker

$ systemctl restart docker
gavraham
  • 129
  • 1
  • 3
0

update following lines in /etc/containers/registries.conf

# Registries that do not use TLS when pulling images or uses self-signed
# certificates.
[registries.insecure]
registries = ['myregistry:5000','myregistry2:5000']

and restart sevice

systemctl restart docker

ManishSingh
  • 1,016
  • 11
  • 9