Custom docker images in a private docker registry backed by s3

Say you want to user docker to containerize your infrastructure. Step 1 is making your infrastructure composable through docker images. Here’s a quick tutorial on how you’d do that.

First, create the registry server:

docker run \
-e SETTINGS_FLAVOR=s3 \
-e AWS_BUCKET=YOUR_REGISTRY \
-e STORAGE_PATH=/\
-e AWS_KEY=YOUR_KEY \
-e AWS_SECRET=YOUR_SECRET \
-e SEARCH_BACKEND=sqlalchemy \
-p 5000:5000 \
registry

Pull an existing container:

docker pull containername

Run it and make some changes (the t flag is to open a teletype and the i flag is to go into interactive mode):

docker run -t -i containername /bin/bash

Make a change in the container and then turn it into an image:

docker commit -m "touched file" -a "Calvin Froedge" ID_YOU_CHANGED new_image_name

Running docker images will show you your new image. Grab its id.

Tag the ID:

docker tag THE_ID localhost:5000/test

Push:

docker tag THE_ID localhost:5000/test

Congrats! You (and anyone else you give access to with AWS key & secret) can start this registry on their machine and download a Docker image.

docker pull localhost:5000/test

This entry was posted in DevOps, Docker. Bookmark the permalink. Both comments and trackbacks are currently closed.