Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

allow insecure registry in host provisioned with docker-machine

Is there anyway to configure --allow-insecure-ssl for docker's deamon created with docker-machine.

commands:

docker-machine create --driver virtualbox dev  eval "$(docker-machine env dev)" docker run myregistry:5000/busybox:latest echo 'hello world' 

output:

Unable to find image 'myregistry:5000/busybox:latest' locally 2015/06/04 16:54:17 Error: v1 ping attempt failed with error: Get           https://myregistry:5000/v1/_ping: EOF. If this private   registry supports only HTTP or HTTPS with an unknown CA certificate,  please add `--insecure-registry myregistry:5000` to the  daemon's arguments. In the case of HTTPS, if you have access to the  registry's CA certificate, no need for the flag; simply place the CA  certificate at /etc/docker/certs.d/myregistry:5000/ca.crt 
like image 843
Montells Avatar asked Jun 04 '15 21:06

Montells


People also ask

Which options configures the Docker daemon to connect to a registry?

In a typical setup where you run your Registry from the official image, you can specify a configuration variable from the environment by passing -e arguments to your docker run stanza or from within a Dockerfile using the ENV instruction. This variable overrides the /var/lib/registry value to the /somewhere directory.

Which is the default Docker registry?

Docker Hub is Docker's official cloud-based registry for Docker images. As you might expect, since Docker Hub is Docker's official registry, it is the default registry when you install Docker.


2 Answers

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.

like image 59
enrique-carbonell Avatar answered Sep 21 '22 05:09

enrique-carbonell


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

like image 20
Fabian Avatar answered Sep 19 '22 05:09

Fabian