Migrate Docker Registry to GCloud Container Registry

Recently we chose to migrate our container registry to GCloud for the following reasons:

  1. We didn’t want to host it ourselves anymore.
  2. We wanted to distribute our docker images world wide for consumption in our Multi-Region scenario.
  3. We run Google Apps/Email and we could just hook into that for permissions to the registry.
  4. Its as close as we could find to a native docker push/pull scenario without spending stupid amounts of money.
  5. Endless number of repositories which was important considering we already have 30 right now and we are just getting started.
  6. We only get charged for storage consumption and egress requests (some caveats apply).
  7. Our old registry was only accessible from within our Platform and developers requested access so they could run images locally.

As was written in a historical post we also evaluated AWS ECR and took a high level look at several other docker image storage opportunities.

What we foundĀ is Google Cloud is doing some great things like providing excellent search opportunities we were missing with our own registry.

Its quite easy to search repositories, images and tags. Even though several of the search capabilities are in an alpha state, I’ve found they work quite well.

List images in a repo:

gcloud alpha container images list --repositories=<repository_name>

List version tags for a given image:

gcloud alpha container images list-tags gcr.io/<repository_name>/<image_name>

 

We then decided to take it to the next phase and ship all our images to Gcloud from our private repository and begin testing it in earnest. Stay tuned for more.

So we wrote a migration script to migrate everything from our private repo.

https://github.com/pearsontechnology/migr8-registry-gcloud

Its completely opensource and under Apache 2.0 so feel free to use it if you find it valuable.

The Readme is pretty good and is quite easy to initiate. It will transfer all repositories, images and version tags.

All you have to do is supply 4 environment variables and make sure glcoud sdk is installed and authenticated.

export GCLOUD_URL="gcr.io/<project-name>"
export REG_URL="docker-registry.example.com:5000"
export GCLOUDPATH = "/usr/bin/gcloud"
export DOCKERPATH = "/usr/bin/docker"