machine icon indicating copy to clipboard operation
machine copied to clipboard

How to connect to private registry via SSL?

Open christianhuening opened this issue 11 years ago • 11 comments

Since Boot2Docker is now deprecated and you are encouraged to use docker-machine instead, I ask myself how to add a certificate from my private docker registry. My usual way of doing it was to add the cert to /etc/certs.d//ca.crt and exit, boot2docker save , down and up.

Since boot2docker save is no more: How is this meant to be accomplished now?

Cheers, Christian

christianhuening avatar Aug 17 '15 14:08 christianhuening

cc @tianon @SvenDowideit @ehazlett for discussion and recommendations

nathanleclaire avatar Aug 18 '15 03:08 nathanleclaire

+1 waiting for a solution or a workaround..

JacsonPaz avatar Aug 22 '15 00:08 JacsonPaz

Here is a hack to make it work until a better solution arrives. Note that the cert should be base64 encoded.

docker-machine.exe scp ca.crt default:.
docker-machine.exe ssh default
sudo mkdir -p /etc/docker/certs.d/<fully-qualified-host-name>
sudo mv ca.crt /etc/docker/certs.d/<fully-qualified-host-name>/ca.crt

ceagan avatar Aug 27 '15 15:08 ceagan

Isn't /var/lib/boot2docker/certs set up in the VM on the persistent storage specifically for this right now? ie, https://github.com/boot2docker/boot2docker/blob/30800b21799f3aedba2150c729aeafc13baad8d9/rootfs/rootfs/etc/rc.d/install-ca-certs, which runs at boot

tianon avatar Aug 29 '15 17:08 tianon

yup.

SvenDowideit avatar Aug 31 '15 01:08 SvenDowideit

@tianon Sorry, don't get you?

christianhuening avatar Aug 31 '15 06:08 christianhuening

Note to self: Add this to docs.

nathanleclaire avatar Aug 31 '15 21:08 nathanleclaire

@christianhuening specifically, something like this seemed to work for me:

host$ docker-machine scp my-private-ca.pem my-machine-name:/tmp
host$ docker-machine ssh my-machine-name

docker$ sudo mkdir /var/lib/boot2docker/certs
docker$ sudo cp /tmp/my-private-ca.pem /var/lib/boot2docker/certs 
docker$ exit

host$ docker-machine restart my-machine-name

shepmaster avatar Sep 01 '15 15:09 shepmaster

@shepmaster Thanks! much appreciated!

christianhuening avatar Sep 03 '15 10:09 christianhuening

@nathanleclaire maybe this issue could be repurposed as a note to add the info to the docs as appropriate?

shepmaster avatar Sep 03 '15 19:09 shepmaster

Yeah, I think I will add one.

nathanleclaire avatar Sep 03 '15 20:09 nathanleclaire