Docker Registry Usage

We set up an internal Docker Registry for applications we wanted to disseminate within our organization. Right now, it’s in testing phase, so we don’t have a recognized certificate for it. That makes things a bit more tricky when trying to use it. Here’s the instructions I put together for our team.

Linux

Download the ‘ca.crt’ file in the same directory as this document. Create the following folder and add the certificate to it:

/etc/docker/certs.d/<url with port>

To interact with the registry, precede files with the machine name and port, and add the ‘–insecure-registry. For example, to download the test ubuntu container in the registry, run the following:

docker pull --insecure-registry <url with port>/batman/ubuntu

Push commands would follow a similar format.

Windows and Mac

Windows and Mac require that a special container instance be created with the flag added. To do so, run the following command:

docker-machine create -d virtualbox --virtualbox-memory 2048 \
 --engine-insecure-registry <url with port> <container name>

To run the new instance, type the following at a command prompt:

docker-machine ssh

If the instance isn’t running, go to VirtualBox and start it.

To start the instance directly when clicking the Docker Quickstart icon, open Docker Toolbox/start.sh. Change the line that reads

VM=default
 to
VM=<container name>

To pull or push an instance from the private docker registry, simply precede the container name with the registry URL. For example, to pull the sample ubuntu instance from the registry, type the following:

docker pull <url>/batman/ubuntu