Where should I set the '--insecure-registry

2019-01-13 05:57发布

问题:

I am using OS X 10.10. When trying to communicate with our team's private docker registry, it keeps giving me errors like this:

Error: Invalid registry endpoint https://registry.xxx.xxx/v1/: Get
https://registry.af-sys.com/v1/_ping: dial tcp xx.xxx.xxx.xxx:xxx: i/o timeout.
If this private registry supports only HTTP or HTTPS with an unknown CA
certificate, please add --insecure-registry...

On Ubuntu system this error can be resolved by adding DOCKER_OPTS into the /etc/default/docker configuration file like this:

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

Does Mac OS have a similar configuration file where I can add the DOCKER_OPTS option?

回答1:

You have to set it to Docker Machine's / Boot2Docker profile file: docker-machine ssh <machine name>

/var/lib/boot2docker/profile

EXTRA_ARGS='
--label provider=virtualbox --insecure-registry myregistry:5000

'

And then restart Docker service.

sudo /etc/init.d/docker restart


回答2:

I was looking for a way to set --insecure-registry in Docker for Mac. Turned out to be simpler than what I first thought...

Click the Docker icon in the tray to open Preferences. Click on the Daemon tab and add your insecure registries in Insecure registries section.

Don't forget to Apply & Restart and you're ready to go.



回答3:

The proper way to set it is via the --engine-insecure-registry argument to docker-machine:

docker-machine create --driver virtualbox \
  --engine-insecure-registry myregistry:5000 dev

You can also pass other options using --engine-opts. For example, set dns via --engine-opt dns=8.8.8.8

This essentially ends up setting EXTRA_ARGS in /var/lib/boot2docker/profile



标签: docker