Docker Registry V2 with Bluemix and SoftLayer Object Storage

Share this post:

Many of you would be delighted to know that the Docker Distribution project now supports OpenStack Swift API based Object Storage as provided by IBM Bluemix, IBM SoftLayer and other similar offerings. In this short article, I’ll show you how you can get your own Docker Registry (part of the Docker Distribution project) up and running with Object Storage in Bluemix and SoftLayer.

The Registry Swift driver was merged into the main Docker Distribution project with PR#493; it has been built into the Registry/2.1 milestone and a Registry 2.1 image is now available from Docker Hub.

Get the Registry Image

You can simply fetch the registry:2.1 image from Docker Hub or easily build the Registry Docker image yourself.

To fetch the image from Docker Hub, all you need to do is:

$ docker pull registry:2.1

If you are a little more adventurous, to build the image on an Ubuntu 14.04 LTS 64-bit host, the following steps worked for me (go-lang 1.4.2 installed):

$ export GOPATH=~/go
$ go get
$ go get
$ cd ~/go/src/
$ docker build -t registry:2.1 .

Run Registry with Bluemix Object Storage

You can create a 30-day free trial account on IBM Bluemix, experiment with the Object Storage V2 service, and connect your Docker Registry to it. The service icon looks like this:


You don’t need to bind the service to any application, you can just get its credentials and connect your Docker Registry to it. Note down your credentials from the UI similar to this:

Object Storage Credentials

From the above UI, click on the gear icon and select “Launch Horizon Dashboard”, create a container, for example, “docker-registry”, although this can be anything, and you can also create this using a swift command-line tool if you wish.

Now simply run the Docker Registry with a command such as follows:

$ docker run -d --name registry-bm \<br />-e REGISTRY_STORAGE='swift' \<br />-e REGISTRY_STORAGE_SWIFT_AUTHURL='your-auth-url/v2.0' \<br />-e REGISTRY_STORAGE_SWIFT_TENANT='your-project' \<br />-e REGISTRY_STORAGE_SWIFT_USERNAME='your-userid' \<br />-e REGISTRY_STORAGE_SWIFT_PASSWORD='your-password' \<br />-e REGISTRY_STORAGE_SWIFT_CONTAINER='docker-registry' \<br />-p 5000:5000 \<br />registry:2.1

Note that the auth-url needs to be appended with /v2.0.

This will run the Docker Registry at the host port 5000 and you’ll be able to push/pull images to/from <your-host-or-IP>:5000.

Run Registry with SoftLayer Object Storage

You can order Object Storage from your account via the SoftLayer portal, and note the credentials provided, for example, something like the following:

SoftLayer Credentials

Then create a container in your Object Storage account, say “docker-registry”, this can be anything, and you can create this from the SoftLayer portal or by using a swift command-line tool if you wish.

Now simply run the Docker Registry with a command such as follows:

$ docker run -d --name registry-sl \<br />-e REGISTRY_STORAGE='swift' \<br />-e REGISTRY_STORAGE_SWIFT_AUTHURL='your-public-auth-url' \<br />-e REGISTRY_STORAGE_SWIFT_USERNAME='your-username' \<br />-e REGISTRY_STORAGE_SWIFT_PASSWORD='your-API-Key' \<br />-e REGISTRY_STORAGE_SWIFT_CONTAINER='docker-registry' \<br />-p 6000:5000 \<br />registry:2.1

Note that we mapped host port 6000 to container’s port 5000 here, so that if you have another Bluemix registry container running, it won’t clash with this one.

This will run the Docker Registry at the host port 6000 and you’ll be able to push/pull images to/from <your-host-or-IP>:6000.

That’s it! See how it’s so quick and simple to run the Docker Registry backed by Bluemix or SoftLayer Object Storage? You can expect that soon the Docker Trusted Registry will be updated with the open source Registry/2.1 version codebase. Please post any feedback or questions below.

Thanks to contributions from the following IBMers:
Sanjay Nayak, Steve Hanley, Philip Estes.

More stories
May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Analyze Logs and Monitor the Health of a Kubernetes Application with LogDNA and Sysdig

This post is an excerpt from a tutorial that shows how the IBM Log Analysis with LogDNA service can be used to configure and access logs of a Kubernetes application that is deployed on IBM Cloud.

Continue reading