Use minio as docker registry storage driver

Among all the various ways of saving files, Amazon s3 service has defined a standard, a lot of services and software supports natively using it as “Object block storage” (that is just a fancy alternative for “saves files and stuff”) and nowadays there are a lot of s3 drop-in replacements.

My favourite one in minio, written in go and ridiculously easy to set up, for the installation you should look at the official documentation.

Today i will show you a little thing i have put up with minio, using it as a remote storage for my private docker registry


Keep in mind you will need a working minio installation with an dedicated bucket, and the following variables:

NAME                   EXAMPLE
{MINIO_SECRET_KEY} => N2nEexm6bSEITcvrA97Mu/uR/yvWpy1bXoGGetYE
{REGION} => us-east-1
{BUCKET_NAME} => docker-registry


We have to write two configuration files, one for the registry configuration (config.yml) and one to build a docker image that uses it (Dockerfile)


version: 0.1
service: registry
addr: :5000
layerinfo: inmemory
accesskey: {MINIO_ACCESS_KEY}
secretkey: {MINIO_SECRET_KEY}
region: {REGION}
regionendpoint: {REGION_ENDPOINT}
bucket: {BUCKET_NAME}
encrypt: false
secure: true
v4auth: true
chunksize: 5242880
rootdirectory: /


FROM registry:2
COPY config.yml /etc/docker/registry/config.yml

Note: Be sure to run the lastest version of minio, versions before “RELEASE.2017–02–16T01–47–30Z” are incompatible with versions of docker registy greater than 2.5.1

Build and run

Now assuming that the Dockerfile and the config.yml are in the current working directory you will have to run those commands:

# Build the docker image
docker build . --tag=my-registry-name
# Run the image
docker run -d -p 5000:5000 my-registry-name

And you are done!

You can now push and pull images from the docker registry and have all saved in minio, you can try deleting & recreating the running registry container and see that the pushed images will be still there :)