allow insecure registry in host provisioned with docker-machine

If you want to add insecure registries to a docker-machine that is already created you can update the profile in the running docker VM.

Steps

  1. SSH into your local docker VM.
    note: if 'default' is not the name of your docker machine then substitute 'default' with your docker machine name
    $ docker-machine ssh {machineName}

  2. Open Docker profile
    $ sudo vi /var/lib/boot2docker/profile

  3. Add this line to the bottom of the profile file. If EXTRA_ARGS already exists, add the insecure registry flag to the EXTRA_ARGS. Substitute in the path[s] to your registries.

    EXTRA_ARGS=" --insecure-registry myserver.pathTo.registry1:5000 --insecure-registry myserver.pathTo.registry2:5000 --insecure-registry myserver.pathTo.registry3:5000 "

  4. Save the profile changes and 'exit' out of the docker-machine bash back to your machine. Then Restart Docker VM substituting in your docker-machine name
    $ docker-machine restart {machineName}

  5. Pull or push something from your registry to ensure it works

My Setup

docker-machine version : 0.6.0, build e27fb87
docker-machine driver : virtualbox


If you are running docker-machine version v0.2 stable, you can't set docker option in light way. But in next version v0.3 this problem was resolved with the creation parameters.

At this moment this feature it's on RC1,then you can use a version v0.3.0-RC-1 or wait for delivery the next stable version v0.3.0(tentatively Jun.16).

Then use parameter --engine-insecure-registry to set --allow-insecure-ssl for docker's daemon, for example:

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

After that you can execute:

docker run myregistry:5000/busybox:latest echo 'hello world'

Additionally you can read about it on project doc.