I recently started using the Docker Registry. as I had a need to store sensitive data; read only deploy keys.

I tried building the image myself and it worked; but I wondered why do I have to build it? So after reviewing a few blog posts I realized I could override almost everything I could dream of without needing to build the image myself. So in an overall attempt to reduce the steps required to produce a registry server I used the stackbrew/registry

docker run -e SETTINGS_FLAVOR=dev -d -v /registry:/tmp/registry -p stackbrew/registry

This binds the registry to localhost:5000 on the server; so in order to access this remotely you need an SSH Tunnel.

ssh ip -L 5000:localhost:5000 -N -f

  • How do you referece in your Dockerfile that you are using a private registry? FROM localhost:5000/coreos/etcd

  • How do you get your Images into the private regstry?

    There are 2 ways you can push an image to your registry.

    1 docker tag

    docker tag af267c0422b8 localhost:5000/coreos/etcd

    2 docker build

    docker build -t localhost:5000/damm/redis:0.0.1 -t localhost:5000/damm/redis:latest git://github.com/damm/docker-redis.git

    Once the image is tagged to your registry you can push it with the docker push command

    docker push localhost:5000/coreos/etcd

    Let's say you need to tag it as a version and latest?

    docker tag af267c0422b8 localhost:5000/coreos/etcd:0.0.1

    docker tag af267c0422b8 localhost:5000/coreos/etcd:latest

    docker push localhost:5000/coreos/etcd

    Pushing tag for rev [af267c0422b8] on {http://localhost:5000/v1/repositories/coreos/etcd/tags/0.0.1}

    Pushing tag for rev [af267c0422b8] on {http://localhost:5000/v1/repositories/coreos/etcd/tags/latest}

Final Words. Using the Registry can give you many benefits; or very little depending on how you use it. 1. Private registry to store your sensitive data that you don't want out in the world.
2. Tag your volumes to the registry and back them up to S3 for backup purposes.
3. Quick and easy way to share your images with a few friends; but not the world.

It's absolutely possible to build your own registry image; but you may not be using Docker to it's best potential if you are building every image for yourself.