Docker registries

Microtica allows you to connect your own Docker registries where you would store Docker images built during pipeline execution.

You can use images to deploy services on Kubernetes clusters.

Currently, Microtica supports two types of private Docker registries:

  • DockerHub
  • Amazon ECR

#Connect your DockerHub registry

In order to connect with DockerHub registry you would need to first create a Personal Access Token from DockerHub portal.

Go to your Account Settings and click on Security tab from the side menu on the left.

Click on New Access Token button to create new access token. A dialog will appear asking you to enter the name of the access token. Enter a name that will distinguish this token from others (e.g. Microtica Pipelines).

DockerHub new access token modal

Click on Create button and new access token will be generated. Copy the value of the token in the clipboard, we would need the value in the next step.

DockerHub generated access token
Revoking access to DockerHub

If you decide to revoke the access to your registry you just need to deactivate or completely remove the access token from the DockerHub portal.

The last thing we need to do is to add the registry in Microtica Portal. To do that click on the Docker Registries side menu under Kubernetes.

Choose a simple and easy to remember name when creating a registry. The name will be used when referencing it from the pipeline steps. Enter the username and token as provided in the DockerHub portal.

Connect DockerHub registry
Default registry

If you mark the registry as default, when composing pipelines, if you don’t specify the registry the default registry will be used automatically.

#Connect your Amazon ECR registry

In order to connect with Amazon ECR registry you would need to first create an IAM user from AWS Console.

From the IAM console choose Users and click on Add User button top left.

Choose a username for the new user and select Programmatic access for Access Type and click on Next: Permission button.

IAM user details

Now we have to choose the permissions to assign to this user. In this particular case we only need access to the ECR service.

Select the Attach existing policies directly option and search for “container”. Then select AmazonEC2ContainerRegistryFullAccess policy and click on Next: Tags button in the bottom right.

IAM select access policy

Follow the next step and at the end click on Create user button.

New access keys are now generated. Copy the value of the keys in the clipboard, we would need the values in the next step.

IAM generated access keys

The last thing we need to do is to add the registry in Microtica Portal. To do that click on the Docker Registries side menu under Kubernetes.

For registry provider choose Amazon ECR.

Choose a simple and easy to remember name when creating a registry. The name will be used when referencing it from the pipeline steps. Enter the Access key Id and Secret access key as provided in the AWS console.

Connect Amazon ECR registry
Default registry

If you mark the registry as default, when composing pipelines, if you don’t specify the registry the default registry will be used automatically.

#Push an image in a Docker registry

Following is an example of a pipeline that builds and pushes an image to a Docker registry:

microtica.yaml

steps:
  PushToDockerHub:
    type: docker-push
    title: Build and push image on DockerHub
    image_name: microtica/my-app
    tag: v0.1.0
    registry: dockerhub
  PushToECR:
    type: docker-push
    title: Build and push image on Amazon ECR
    image_name: microtica/my-app
    tag: v0.1.0
    registry: ecr

In this example we have two steps, the first one pushes the image on DockerHub and the second one pushes the image on ECR registry.

You can learn more about working with Docker images in the Pipeline Docker Push Step.