27
Apr

Permenently allowing an insecure registry on docker-machine / boot2docker

Adding the --insecure-registry flag has been a bit of a pain for me. I’d ssh into the boot2docker machine and edit the file before restarting docker on the VM. Unfortunately every time the docker machine restarted I would lose the configuration and have to perform the same steps again.

Fortunately, I discovered the configuration files for the docker-machines and that it allows you to specify insecure registries by configuration.

Do the following to enable your insecure registry once and for all:

Edit the configuration file for your docker-machine (default in this case):

vi ~/.docker/machine/machines/default/config.json

Locate the `InsecureRegistry` key and simply append your insecure registry to the array.

    "HostOptions": {
        "Driver": "",
        "Memory": 0,
        "Disk": 0,
        "EngineOptions": {
        "ArbitraryFlags": [],
        "Dns": null,
        "GraphDir": "",
        "Env": [],
        "Ipv6": false,
        "InsecureRegistry": [
            "insecure-registry.mydomain.com"
        ],

Then re-provision the machine with:

docker-machine provision default

Note: re-provisioning will likely lose any manual changes you made to the VM.