21

I want to add an insecure-registry for testing purposes on a Windows 10 machine for Docker. Unfortunately I was not able to find any information where the usual /etc/docker/default config file is located on Windows.

The error you get when trying to pull from an insecure registry without adding it to the options is:

Failed to tls handshake with x.x.x.x cannot validate certificate for x.x.x.x because it doesn't contain any IP SANs

I did find a way which looks promising:

  1. edit C:/Users/Username/.docker/machine/default/config.json
  2. add the registry : "InsecureRegistry": ["x.x.x.x:port"]
  3. restart docker with (?) docker-machine.exe restart default

but now I get this error:

Get https://x.x.x.x:port/v1/_ping: x509: cannot validate certificate for x.x.x.x because it doesn't contain any IP SANs

(https://akrambenaissi.com/2015/11/17/addingediting-insecure-registry-to-docker-machine-afterwards/)

Update: After restarting Windows it worked:

  • I received "unauthorized: authentication required"
  • thus > docker login x.x.x.x:port and now it's working!
Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
hb0
  • 3,350
  • 3
  • 30
  • 48

5 Answers5

26

The following worked for me:

  1. edit C:/Users/Username/.docker/machine/default/config.json
  2. add the registry : "InsecureRegistry": ["x.x.x.x:port"]
  3. restart docker (see comment below)*
  4. restart windows (there must be a better way ;-)
  5. docker login x.x.x.x:port
hb0
  • 3,350
  • 3
  • 30
  • 48
1

After restarting my computer after changing config.json, I still wasn't able to connect to our insecure registry. I am using a self-named docker-machine (so, not default), maybe that has something to do with it. What did work was, after changing config.json and restarting the docker-machine (not my computer), executing the docker-machine regenerate-certs [machinename] command.

Before that command, 'docker info' did not mention the new registry, after regenerating the certs it did.

pietmarcus
  • 51
  • 1
  • 3
0

The method from B.L. is working well. It's true that "docker-machine.exe restart" does not work, and you can check it with "docker info": you should see in Insecure Registries the entry that you added. So restarting Windows was the only way for me too to make it appear. And then pushing was working (so good!)

Port number is not mandatory, and "InsecureRegistry": ["x.x.x.x"] is also working. Hope this will help!

Dertron
  • 141
  • 1
  • 8
0

My setup used Docker Toolbox, so hb0's answer helped me, but the InsecureRegistry property in the config.json file was under HostOptions.EngineOptions on my installation.

My config.json file path was also slightly different. Mine was in C:/Users/YOUR_USERNAME/.docker/machine/machines/default/config.json (Note the extra machines directory).

AdHorger
  • 470
  • 6
  • 13
0

The following worked for me:

  • edit C:/Users/Username/.docker/daemon.json
  • add the registry : "insecure-registries": ["x.x.x.x:port"]
  • restart docker
helvete
  • 2,455
  • 13
  • 33
  • 37
Xander Zi
  • 1
  • 1