Private Docker Registries

Lattice does not currently ship with a private Docker registry. We plan on remedying this soon to improve our developer experience. Until then, follow these instructions to spin up a Docker registry, configure Lattice to allow communication with the private registry, and then import a Docker image to the private registry and launch it via Lattice.

These instructions are only valid up to Lattice v0.5.0. We’ve opened [#106359650] to track documenting support for Private Docker Registries on v0.6.0+.

Launch a Private Docker Registry

1. Allow the Docker daemon to communicate with the private registry (OSX only)

The following assumes:

  • Using the latest Docker Machine
  • Using IP 192.168.99.100 for Docker Machine. Find the ip on your Docker Machine vm with docker-machine ip DOCKER-MACHINE-NAME

Use docker-machine ssh DOCKER-MACHINE-NAME to update/create the file /var/lib/boot2docker/profile:

sudo -s
echo 'EXTRA_ARGS="$EXTRA_ARGS --insecure-registry 192.168.99.100:5000"' >> /var/lib/boot2docker/profile

And restart docker from the host machine:

docker-machine restart DOCKER-MACHINE-NAME

2. Launch the private registry

From your host machine:

docker run -p 5000:5000 registry

Lattice VM configuration

The following assumes you are using the local Vagrant VM.

Allow Garden-Linux to communicate with the private registry

SSH to the Lattice VM with vagrant ssh from the directory with the Lattice Vagrantfile then modify the Garden-Linux config file (/etc/init/garden-linux.conf). Look for the garden-linux start command:

garden-linux \
    -disableQuotas=true \
    -listenNetwork=tcp \
    ...
    >> /var/lattice/log/garden-linux-service.log 2>&1

and add the flag -insecureDockerRegistryList="192.168.99.100:5000" to the start command:

garden-linux \
    -disableQuotas=true \
    -listenNetwork=tcp \
    -insecureDockerRegistryList="192.168.99.100:5000" \
    ...
    >> /var/lattice/log/garden-linux-service.log 2>&1

Next, restart Garden-Linux:

sudo initctl stop garden-linux
sudo initctl start garden-linux

Push an example docker image to the private registry

Pull the lattice-app image from DockerHub and push it to the local private registry:

docker pull cloudfoundry/lattice-app
IMAGE_ID=`docker images | grep lattice-app | awk '{ print $3 }'`
docker tag $IMAGE_ID 192.168.99.100:5000/lattice-app
docker push 192.168.99.100:5000/lattice-app

Launch the docker image hosted on the private registry on Lattice

ltc create private-lattice-app 192.168.99.100:5000/lattice-app

If there is a problem, run ltc debug-logs in a shell while you ltc remove private-lattice-app and retry the ltc create.

Note: you will need ltc version 0.2.3 or greater.

Modular. Flexible. Powerful

Application Instances