Skip to content

Setup Docker Distribution Setup

Philip Haynes edited this page Oct 28, 2020 · 1 revision

The Setup of Docker Distribution

Why

Docker Distribution is the https://github.com/docker/distribution What is Docker Distribution

Why not Nexus?

Nexus is default enterprise repos and is meant to support Docker containers (as a proxy). Well we tried and it was a time-consuming and ultimately unproductive experience. Whilst a set up was found that it was possible to create a configuration that worked without SSL, without SSL is really a deal breaker.

Additionally, the nexus option was: Expensive to run requiring 8Gb with 4 CPU cores Much more difficult to configure through scripts, although we didn't get to that since; Were unable to practically get it working in a reasonable timeframe.

Steps

  1. Create a docker VM. Can be very lightweight
  2. Create a user account
  3. Create self signed certificates.
  4. C

Create User Account and open up ports

ufw allow 443 useradd machine mkdir /home/machine chown machine /home/machine usermod -aG docker machine su - machine mkdir registry mkdir certs

Certificate Creation

openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/apache.key -out /etc/ssl/certs/apache.crt

docker run -d \ --restart=always \ --name registry \ -v "$(pwd)"/certs:/certs \ -v /home/machine/registry:/var/lib/registry \ -e REGISTRY_HTTP_ADDR=0.0.0.0:443 \ -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/apache.crt \ -e REGISTRY_HTTP_TLS_KEY=/certs/apache.key \ -p 443:443 \ registry:2

Then run a smoke test: `` docker pull localhost/hello-world docker tag hello-world localhost/hello docker push localhost/hello

``

Public Demonstration Configuration

To test the configuration, a demonstration instance was stood up and a CDN proxy was used to provide terminating SSL so that only self signed keys were required internally.

`` $ docker run docker.repo.com/hello

Hello from Docker! This message shows that your installation appears to be working correctly. ``