Wednesday, March 19, 2014

Docker Registry in a Container on Fedora, Using Docker

In just a few simple steps, you can have an instance of the Docker registry up and running in a Docker container. This one was contributed by Stephen Tweedie. You can get the latest Dockerfiles here:

Tested on Docker 0.8.1 and Fedora 20

Get the version of Docker:

# docker version

To build:

# docker build -rm -t username/registry .

To run:

# docker run -d -p 5000:5000 username/registry

To use a separate data volume for /var/lib/docker-registry (recommended, to allow image update without losing registry contents):

Create a data volume container: (it doesn't matter what image you use here, we'll never run this container again; it's just here to reference the data volume)

# docker run --name=registry-data -v /var/lib/docker-registry fedora true

And now create the registry application container:

# docker run --name=registry -d -p 5000:5000 --volumes-from=registry-data username/registry

Test it...

# docker tag /registry localhost:5000/username/registry
# docker push localhost:5000/username/registry

No comments:

Post a Comment