Codefresh Docker Registry

How to use the integrated Docker registry of your account

When creating a Codefresh account you will automatically get access to your Codefresh Registry which stores and lets you distribute docker images.

Note: The Codefresh Registry will be read-only from July 1 - July 14 and then fully removed from the service July 15, 2020.
See this blog post for more information as well as the migration instructions.

All images built in Codefresh are automatically pushed to your Codefresh registry.

With the integrated Codefresh registry you will be able to:

  • Control where your images are being stored
  • Fully own your images distribution pipeline
  • Integrate image storage and distribution into your in-house development workflow

Notice that despite the extra features, the Codefresh registry is using the official Docker registry API and is usable even outside of Codefresh, using any of your existing Docker tools.

All images stored in Codefresh registry are private by default. To access and push images you need to authenticate using a token (explained below).

Viewing your Docker images

To see all images currently stored in the Codefresh Registry, select Artifacts -> Images from the left sidebar and you will see a sorted list of all images.

Codefresh Registry Image List

Codefresh Registry Image List

For each image you get some basic details such as the git branch, commit message and hash that created it, date of creation as well as all tags. You can click on any image and look at its individual metadata.

Notice that the last Docker image produced by any successful Codefresh pipeline will automatically be pushed to the Codefresh registry. This behavior is completely automated and requires zero configuration on your part.

You can still use the push pipeline step if you wish to customize the image details or want to use an external registry such as Azure, Google, Bintray etc.

On the top left of the screen you can find several filters that allow you to search for a specific subset of Docker images:

Codefresh Registry Image filters

Codefresh Registry Image filters

Filters include:

  • Tagged/untagged images
  • Base image name
  • Git branch
  • Tag
  • Pipeline volumes

You can add multiple filters and they will work in an AND manner.

On the right side of the screen you also have a list of buttons for actions on each Docker image. These are:

  • Launching a Docker image as a test environment
  • Promoting a Docker image (explained below)
  • Looking at the docker commands that allow you to pull the image locally on your workstation
  • Re-running the pipeline that created this image

Promoting Docker images

As we already mentioned, all successful Codefresh pipelines automatically push the Docker image they produced in the internal Codefresh registry.

You have the capability to “promote” any image of your choosing and push it to an external Registry that you have integrated into Codefresh (such as Azure, Google, Bintray etc)

To do this, first you need to connect at least one external Codefresh registry.

Once that is done, click the Promote button for the image you wish to promote:

Promoting a Docker image

Promoting a Docker image

You will get a list of your external registries. Choose the target Registry and define the tag that you want to push. Then click the Promote button to “copy” this image from the Codefresh registry to the target Registry.

You can also do a promotion programmatically in a pipeline by using the push step.

Generate CFCR Login Token

You can use the internal Codefresh registry as is, for automatic pushing from your pipelines. For most production environments however, you will need to interface with it in an external manner. For these cases you need to authenticate to the Registry (as by default all Codefresh registry images are private).

First, you need a Codefresh API token. To get it, login into Codefresh and navigate to User Settings. Generate a Codefresh Registry Access Token and copy this token to your clipboard.

Codefresh Registry Access Token

Codefresh Registry Access Token

You can create multiple tokens for different uses. From the same screen you can also revoke any existing token if it is not used anymore or has been compromised.

Use Codefresh Registry Locally

By default, all Codefresh users have permissions to push, pull and search Docker images in every user Codefresh account. Once you have your token you can use any Docker command from your local workstation.

# login to CFCR
docker login -u CF_USER_NAME -p CFCR_LOGIN_TOKEN
# push Docker image
docker push
# pull Docker image
docker pull
CF_USER_NAME Your username in Codefresh
CFCR_LOGIN_TOKEN CFCR Login Token that was generated in the previous step
CF_ACCOUNT Name of your account in Codefresh
ANY_IMAGE Image name
ANY_TAG Tag of your image

Notice that any images you push externally in this manner will NOT appear in the Codefresh UI. They are still present in the registry (and you can pull them with the respective Docker commands), but they are not visible in the Image list in your Codefresh UI.

Part of the rationale actually relates to security. The only images we show in the UI are ones that were built with Codefresh. Building images locally doesn’t follow best practices since those images can contain anything and aren’t tied to source code.

Use Codefresh Registry in Codefresh

To integrate with Codefresh Registry (e.g. for deploying to a Kubernetes cluster), first go to your Account Configuration, by clicking on Account Settings on the left sidebar. On the first section called Integrations click the Configure button next to Docker Registry.

Finally click Add Registry and select Codefresh Registry from the new registry drop down and then provide the following:

  • Registry Name - a unique name for this configuration.
  • Username - your username in Codefresh.
  • Access token - your generated access token.

Codefresh Docker registry registry

Images built in Codefresh

  • All images built in Codefresh are automatically pushed to the Codefresh registry after the build.
  • Distinguishing between images which were pushed to the registry and old images which were not pushed (Turquoise tags for new and Grey tags for old).
  • To push the old images to the Codefresh Registry you can do it on the tab Images, just click on the button Promote image and specify the image name in the format<ACCOUNT>/<IMAGE>.

Pull image from Codefresh Registry

In the tab Images for each image, you can find the command to pull this image from Codefresh Registry.

Codefresh Docker registry registry

Login To CFCR In order to pull images from Codefresh’s registry you must first login. Use this Docker command to authenticate.

docker login

docker login -u <USERNAME> -p <ACCESS_TOKEN>

Pull Docker Image Use this Docker pull command to download the image

docker pull

docker pull<ACCOUNT>/<IMAGE>:<TAG>

Remove images from Codefresh Registry

The Codefresh Registry is fully managed for you and the amount of space it consumes does not affect you in any way (Codefresh pricing does not depend on the space you consume for Docker images).

If you still want to remove an image from the respective view you can just untag it.

Removing image from Codefresh registry

Removing image from Codefresh registry

Once you remove all of its tags, the image will not be shown in the internal Codefresh registry list.

See also