Running a local Docker registry


When you’re using Docker extensively, you sometimes need to run your own registry in order to push images around in your local network - or even on your local machine. For that you need a registry where you can push and pull images. With Docker itself, it’s easy to set it up. Here is a small docker-compose.yml which runs a registry and a simple frontend:

registry:
  image: registry:2
  volumes:
  - data:/var/lib/registry
  ports:
  - 5000:5000
frontend:
  image: konradkleine/docker-registry-frontend:v2
  links:
  - registry
  ports:
  - 8080:80
  environment:
  - ENV_DOCKER_REGISTRY_HOST=registry
  - ENV_DOCKER_REGISTRY_PORT=5000

The registry is persisting its data into the directory data, so nothing is lost if you throw away and recreate the container.

Save the file as docker-compose.yml and start it via docker-compose up in the same directory. After that you can open http://localhost:8080 and you see a basic frontend (taken from kwk/docker-registry-frontend).

Docker Registry with Frontend

Now when you push an image to your registry with the following command it becomes visible on the frontend:

docker pull alpine && docker tag alpine localhost:5000/alpine
docker push localhost:5000/alpine

Refresh the registry frontend and you’ll see the new image is available. You can now pull it with the following command:

docker pull localhost:5000/alpine

Have fun!

Weitere Artikel

Gronkh ist jetzt ein Rundfunksender...

Crossfit Regionals 2018 in Berlin

Crossfit Open 2018

Qutebrowser userscript for TT-RSS

Aufbau eines Hackintosh

Enable request logging in Jetty 9.1

Hacktoberfest 2017

Automatische Erneuerung von Lets Encrypt Zertifikaten

Neue Antennen für meine Fritzbox

Fitness vs Gesundheit