Docker config file location on windows to, e.g., enable insecure registry / docker options
Asked Answered
B

5

22

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!
Bouncing answered 9/5, 2016 at 9:41 Comment(0)
B
29

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
Bouncing answered 9/5, 2016 at 10:14 Comment(2)
on windows10 with current docker-desktop version 2.0.0.2 (30215); right-click: restart... on the icon in the taskbar works fine to restart docker daemon.Antique
C:/Users/username/.docker/daemon.jsonWrung
M
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.

Mcmurry answered 23/5, 2018 at 10:43 Comment(1)
running regenerate-certs was the way for me, helped my Docker to take the changes without a computer rebootNauseating
K
1

The following worked for me:

  • edit C:/Users/Username/.docker/daemon.json
  • add the registry : "insecure-registries": ["x.x.x.x:port"]
  • restart docker
Kylix answered 13/1, 2023 at 10:52 Comment(0)
N
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!

Namhoi answered 27/4, 2017 at 8:45 Comment(0)
G
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).

Ginnifer answered 27/9, 2019 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.