Getting Started with Kontena Cloud Image Registry

Do you want a zero-maintenance, secure and ready-to-go solution for storing Docker images? Kontena Cloud Image Registry is the answer!

Kontena Cloud Image Registry is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. It's tightly integrated with your Kontena Cloud environment and you can just start using it straight away, without needing to set up or maintain any other registries or managing and mapping the organization structure on some other service.

Kontena Cloud Image Registry is secure and private by default: only the people in the organization or development team may access the images. It works with standard Docker CLI tools and may be used from any external CI/CD pipelines without hassle.

In the following sections we'll walk you through the process of how you can get easily started using Kontena Cloud Image Registry today.

Getting started

Kontena Cloud Image registry images.kontena.io is enabled for every Kontena Cloud organization by default and you can access it on the Kontena Cloud Dashboard

Image Repositories

Kontena Cloud Image Registry consists of image repositories under a Kontena Cloud organization namespace.

To create an image repository you can click the "Create an Image Repository" button or plus icon at anytime.

It is also totally fine to push a Docker image to a repository under your organization namespace. The registry will create a repository automatically.

Push Image from Your Local Machine

To push a Docker image from your local machine, you first need to login to the Image Registry. Kontena CLI provides a handy shortcut for that and you can just run the command:

$ kontena cloud image-repository login-docker

After this you are ready to push images to the repository. We are using itzg/minecraft-server as a base image.

$ docker pull itzg/minecraft-server:latest 
$ docker tag itzg/minecraft-server:latest images.kontena.io/acme/minecraft-server:latest
$ docker push images.kontena.io/acme/minecraft-server:latest
The push refers to repository [images.kontena.io/acme/minecraft-server]  
bf4068483143: Pushed  
bc355ce69543: Pushed  
1815c0335c91: Pushed  
5471861cde7d: Pushed  
703d2953ca76: Pushed  
9ffbffaa3acb: Pushed  
588922abe7ee: Pushed  
eb64e2adb69a: Pushed  
0b05ab3d575c: Pushed  
77b3b848241a: Pushed  
fbe7972c9e82: Pushed  
6dfaec39e726: Pushed  
latest: digest: sha256:fd2ff9b2ab4ee22785076d59c257a6c0064f79a6483a13857d7570fa5e5502e1 size: 2832  

Using Repositories with the Kontena Platform

In order to use these Docker images, your Kontena Platform should be configured to access the Kontena Cloud Image Registry. The easiest way is to enable the registry from Platform options on the Kontena Cloud Dashboard.

It is also possible to do it in the embedded terminal on the Kontena Cloud Dashboard or with Kontena CLI. First you need to create a permanent Kontena Cloud access token:

> kontena cloud token create <NAME>

And after that, add an external image registry configuration to your Kontena Platform:

> kontena external-registry add --username <USERNAME> --email <EMAIL> --password <TOKEN> images.kontena.io

USERNAME - your Kontena Cloud username
EMAIL - your Kontena Cloud email
TOKEN - the Kontena Cloud permanent token from the previous step

Using Repositories with Kontena Stacks

Once the image registry is enabled for the platform, you can install a Kontena Stack that uses the image:

> kontena stack install

and paste the following kontena.yml file

stack: acme/minecraft-server  
description: Minecraft server with selectable version  
version: 0.1.0  
services:  
  server:
    image: images.kontena.io/acme/minecraft-server:latest
    stateful: true
    ports:
      - "25565:25565"
    environment:
      - EULA=true

If using Kontena CLI, save the snippet as kontena.yml before running the stack install command

After the application is running, you can verify from stack events that the image is used:

> kontena stack events minecraft-server
TIME                      TYPE                      MESSAGE  
2018-01-19T09:29:15.837Z  service:create_instance   pulling image images.kontena.io/acme/minecraft-server:latest for minecraft-server/server-1 (spring-frost-8706)  
2018-01-19T09:29:26.230Z  service:create_instance   pulled image images.kontena.io/acme/minecraft-server:latest for minecraft-server/server-1 (spring-frost-8706)  
2018-01-19T09:29:26.292Z  service:create_instance   created data volume container for minecraft-server/server-1 (spring-frost-8706)  
2018-01-19T09:29:26.566Z  service:create_instance   service minecraft-server/server-1 instance created (spring-frost-8706)  
2018-01-19T09:29:26.857Z  service:create_instance   service minecraft-server/server-1 instance started (spring-frost-8706)  

And also verify that the application is really running:

> kontena service exec minecraft-server/server mcstatus localhost status
version: v1.12.2 (protocol 340)  
description: "{u'text': u'A Minecraft Server Powered by Docker'}"  
players: 0/20 No players online  

Integration with CI/CD pipelines

One typical use case for the Kontena Cloud Image Registry is to integrate it as part of your CI/CD pipelines. Typically docker login is part of the image building pipeline step.

To enable that you can create a permanent Kontena Cloud access token:

> kontena cloud token create <NAME>

Use your Kontena Cloud username and access token as credentials and the url https://images.kontena.io to grant access for the CI/CD tool to the Kontena Cloud Image Registry.

You can see more detailed example here: Continuous delivery and deployment with GitLab CI

Pricing

Kontena Cloud Image Registry pricing is very straightforward. Each Private Image Repository costs $2 / month. For each repository you can have an unlimited number of tags.

Additional resources

Want to find out more? Check out the Kontena Cloud Image Registry documentation.

If you want to try how easy it can be to use the Kontena Cloud Image Registry in conjunction with Kontena Cloud, go and sign-up to Kontena Cloud, spin up your test platform and start using an image repository.

Image Credit: Binary Code Binary System by Gerd Altmann.