Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Remove deprecated sections except for auth configuration.
Add note about auth configuration deprecation.

Signed-off-by: Derek McGowan <>
5 contributors

Users who have contributed to this file

@mikebrow @kzys @dmcgowan @voltbit @AkihiroSuda

Configure Image Registry

This document describes the method to configure the image registry for containerd for use with the cri plugin.

NOTE: registry.mirrors and registry.configs as previously described in this document have been DEPRECATED. As described in the cri config you should now use the following configuration

   config_path = "/etc/containerd/certs.d"

Configure Registry Credentials

NOTE: registry.configs.*.auth is DEPRECATED and will NOT have an equivalent way to store unecrypted secrets in the host configuration files. However, it will not be removed until a suitable secret management alternative is available as a plugin. It remains supported in 1.x releases, including the 1.6 LTS release.

To configure a credential for a specific registry, create/modify the /etc/containerd/config.toml as follows:

# explicitly use v2 config format
version = 2

# The registry host has to be a domain name or IP. Port number is also
# needed if the default HTTPS or HTTP port is not used.
  username = ""
  password = ""
  auth = ""
  identitytoken = ""

The meaning of each field is the same with the corresponding field in .docker/config.json.

Please note that auth config passed by CRI takes precedence over this config. The registry credential in this config will only be used when auth config is not specified by Kubernetes via CRI.

After modifying this config, you need to restart the containerd service.

Configure Registry Credentials Example - GCR with Service Account Key Authentication

If you don't already have Google Container Registry (GCR) set-up then you need to do the following steps:

Refer to Pushing and pulling images for detailed information on the above steps.

Note: The JSON key file is a multi-line file and it can be cumbersome to use the contents as a key outside of the file. It is worthwhile generating a single line format output of the file. One way of doing this is using the jq tool as follows: jq -c . key.json

It is beneficial to first confirm that from your terminal you can authenticate with your GCR and have access to the storage before hooking it into containerd. This can be verified by performing a login to your GCR and pushing an image to it as follows:

docker login -u _json_key -p "$(cat key.json)"

docker pull busybox

docker tag busybox

docker push

docker logout

Now that you know you can access your GCR from your terminal, it is now time to try out containerd.

Edit the containerd config (default location is at /etc/containerd/config.toml) to add your JSON key for domain image pull requests:

version = 2

      endpoint = [""]
      endpoint = [""]
      username = "_json_key"
      password = 'paste output from jq'

Note: username of _json_key signifies that JSON key authentication will be used.

Restart containerd:

service containerd restart

Pull an image from your GCR with crictl:

$ sudo crictl pull

DEBU[0000] get image connection
DEBU[0000] connect using endpoint 'unix:///run/containerd/containerd.sock' with '3s' timeout
DEBU[0000] connected successfully using endpoint: unix:///run/containerd/containerd.sock
DEBU[0000] PullImageRequest: &PullImageRequest{Image:&ImageSpec{,},Auth:nil,SandboxConfig:nil,}
DEBU[0001] PullImageResponse: &PullImageResponse{ImageRef:sha256:78096d0a54788961ca68393e5f8038704b97d8af374249dc5c8faec1b8045e42,}
Image is up to date for sha256:78096d0a54788961ca68393e5f8038704b97d8af374249dc5c8faec1b8045e42

NOTE: The configuration syntax used in this doc is in version 2 which is the recommended since containerd 1.3. For the previous config format you can reference