| copyright |
|
||
|---|---|---|---|
| lastupdated | 2026-08-03 | ||
| keywords | Docker, private repository, images, building images, trash, recycle bin, restoring images, namespace, cli, tag, api key, upload images, pull images, push images | ||
| subcollection | Registry |
{{site.data.keyword.attribute-definition-list}}
{: #registry_images_}
You can securely store and share Docker images with other users by adding images to your namespace{: term} in {{site.data.keyword.registrylong}}. {: shortdesc}
Every image that you want to add to your namespace must exist on your local computer first. You can either download (pull) an image from another repository to your local computer, or build your own image from a Dockerfile{: term} by using the Docker build command. To add an image to your namespace, you must upload (push) the local image to your namespace in {{site.data.keyword.registrylong_notm}}.
Do not put personal information in your container images, namespace names, description fields, or in any image configuration data (for example, image names or image labels). {: important}
{: #registry_images_pulling_reg} {: help} {: support}
You can pull (download) an image from any private or public registry{: term} source to your computer, and then tag it for later use in {{site.data.keyword.registrylong_notm}}.
{: caption="Pulling images from another registry" caption-side="bottom"}{: external download="../images/pulling_images_mul.svg"}
Before you begin, complete the following tasks.
-
Install the {{site.data.keyword.registryshort}} command-line interface (CLI) to work with images in your namespace.
-
Set up your own namespace in {{site.data.keyword.registrylong_notm}}.
-
Make sure that you can run Docker commands without root permissions{: external}. If your Docker client is set up to require root permissions, you must run
ibmcloud login,ibmcloud cr login,docker pull, anddocker pushcommands withsudo.If you change your permissions to run Docker commands without root privileges, you must run the
ibmcloud logincommand again.
-
Download the image, see Pull an image in the Getting Started documentation.
If you get an
unauthorized: authentication requiredor adenied: requested access to the resource is deniedmessage, run theibmcloud cr logincommand. {: tip}
After you pull an image and tag it for your namespace, you can upload (push) the image from your local computer to your namespace.
If you deploy a workload that pulls an image from {{site.data.keyword.registryshort_notm}} and your pods fail with an ImagePullBackOff status, see Why do images fail to pull from registry with ImagePullBackOff or authorization errors? for assistance. {: tip}
{: #registry_images_pushing_namespace} {: help} {: support}
You can push (upload) an image from your computer to your namespace in {{site.data.keyword.registrylong_notm}} to store your image and share it with other users.
{: caption="Push images to your namespace" caption-side="bottom"}{: external download="../images/pushing_images_mul.svg"}
Before you begin, complete the following tasks.
-
Install the CLI to work with images in your namespace.
-
Set up your own namespace in {{site.data.keyword.registrylong_notm}}.
-
Pull an image on your local computer and tag the image with your namespace information.
-
Make sure that you can run Docker commands without root permissions{: external}. If your Docker client is set up to require root permissions, you must run
ibmcloud login,ibmcloud cr login,docker pull, anddocker pushcommands withsudo.If you change your permissions to run Docker commands without root privileges, you must run the
ibmcloud logincommand again.
{{site.data.keyword.registrylong_notm}} supports other clients as well as Docker. To log in by using other clients, see Accessing your namespaces interactively. {: tip}
To upload (push) an image, complete the following steps:
-
Log in to the CLI by running the
ibmcloud cr logincommand.ibmcloud cr login
{: pre}
You must log in if you pull an image from your private {{site.data.keyword.registrylong_notm}}. {: requirement}
If you have a problem when you try to log in, see Why can't I log in to {{site.data.keyword.registryshort_notm}}? for assistance. {: tip}
-
To view all namespaces that are available in your account, run the
ibmcloud cr namespace-listcommand. -
Upload the image to your namespace.
If you get an
unauthorized: authentication requiredor adenied: requested access to the resource is deniedmessage, run theibmcloud cr logincommand. {: tip}
After you push your image to {{site.data.keyword.registrylong_notm}}, you can do one of the following tasks.
- Manage security with Vulnerability Advisor to find information about potential security issues and vulnerabilities.
- Create a cluster and use this image to deploy a container to the cluster in {{site.data.keyword.containerlong_notm}}.
{: #registry_images_copying} {: help} {: support}
You can copy images between registries by pulling an image from a registry in one region and pushing it to a registry in another region so that you can share the image with users in both regions.
{: caption="Copying images between registries" caption-side="bottom"}{: external download="../images/copying_images_mul.svg"}
Before you begin, complete the following tasks.
-
Install the CLI to work with images in your namespace.
-
Set up your own namespace in {{site.data.keyword.registrylong_notm}}.
-
Make sure that you can run Docker commands without root permissions{: external}. If your Docker client is set up to require root permissions, you must run
ibmcloud login,ibmcloud cr login,docker pull, anddocker pushcommands withsudo.If you change your permissions to run Docker commands without root privileges, you must run the
ibmcloud logincommand again.
To copy an image between two registries, complete the following steps:
- Pull an image from a registry.
- Push the image to another registry. Make sure that you use the correct domain name for the new region you're targeting.
After you copy your image, you can do one of the following tasks.
- Manage image security with Vulnerability Advisor to find information about potential security issues and vulnerabilities.
- Create a cluster and use this image to deploy a container to the cluster in {{site.data.keyword.containerlong_notm}}.
{: #registry_images_source} {: help} {: support}
Create an image by using the ibmcloud cr image-tag command.
In the region that you're logged in to, create an image in {{site.data.keyword.registrylong_notm}} that refers to an existing image in the same region. This action is supported for source images that are created by using supported versions of Docker Engine, see Support for Docker.
New images that are created by using this mechanism do not retain signatures. If you require the new image to be signed, do not use this mechanism. {: important}
Before you begin, complete the following tasks.
- Install the CLI to work with images in your namespace.
- Ensure that you have access to a private namespace in {{site.data.keyword.registrylong_notm}} that contains a source image to which you want to refer another image.
To create an image from a source image, complete the following steps.
-
Log in to the CLI by running the
ibmcloud cr logincommand.ibmcloud cr login
{: pre}
-
Run the following command to add the new reference, where
SOURCE_IMAGEis the name of your source image andTARGET_IMAGEis the name of your target image. The source and target images must be in the same region.SOURCE_IMAGEmust be in the formatrepository:tagorrepository@digestandTARGET_IMAGEmust be in the formatrepository:tag, for example,us.icr.io/namespace/image:latest.To find the names of your images, run
ibmcloud cr image-list. Combine the content of the Repository column (repository) and Tag column (tag) separated by a colon (:) to create the image name in the formatrepository:tag. To identify your image by digest, run theibmcloud cr image-digestscommand. Combine the content of the Repository column (repository) and the Digest column (digest) separated by an at (@) symbol to create the image name in the formatrepository@digest. If the list images command times out, see Why is it timing out when I list images? for assistance. {: tip}ibmcloud cr image-tag [SOURCE_IMAGE] [TARGET_IMAGE]
{: pre}
-
Verify that the new image was created by running the following command, and check that the image is shown in the list with the same image digest as the source image.
ibmcloud cr image-list
{: pre}
{: #registry_api_key_push_image} {: help} {: support}
Create a service ID that uses an API key{: term} to push images to {{site.data.keyword.registrylong_notm}}.
Complete the following steps:
- Create a service ID, see Creating and working with service IDs.
- Create a policy that gives the service ID permission to access the registry, for example, Administrator and Manager roles, see Managing IAM access for {{site.data.keyword.registryshort_notm}}.
- Create an API key, see Creating an API key for a service ID.
- Use the API key to log in to registry so that you can push images to the registry, see Automating access to {{site.data.keyword.registrylong_notm}}.
- Push your images, see Pushing Docker images to your namespace.
You can now use clusters to pull the images, see Building containers from images.
{: #registry_images_untag} {: help} {: support}
You can remove a tag, or tags, from an image in your private {{site.data.keyword.cloud_notm}} repository, and make sure that the underlying image and any other tags remain in place by using the ibmcloud cr image-untag command.
If multiple tags exist for the same image digest within a repository and you want to remove the underlying image and all its tags, see Deleting images from your private {{site.data.keyword.cloud_notm}} repository. {: tip}
To remove a tag, or tags, by using the CLI, complete the following steps:
-
Log in to {{site.data.keyword.cloud_notm}} by running the
ibmcloud logincommand. -
To remove a tag, run the following command, where
IMAGEis the name of the image that you want to remove, in the formatrepository:tag. If a tag is not specified in the image name, the command fails. You can delete the tags for multiple images by listing each private {{site.data.keyword.cloud_notm}} registry path in the command with a space between each path.ibmcloud cr image-untag IMAGE
To find the names of your images, run
ibmcloud cr image-list. Combine the content of the Repository column (repository) and Tag column (tag) separated by a colon (:) to create the image name in the formatrepository:tag. {: tip} -
Verify that the tag was removed by running the following command, and check that the tag does not show in the list.
ibmcloud cr image-list
{: pre}
If the list images command times out, see Why is it timing out when I list images? for assistance. {: tip}
{: #registry_images_remove}
You can delete unwanted images from your private {{site.data.keyword.cloud_notm}} repository by using either the {{site.data.keyword.cloud_notm}} console or the CLI.
If you want to delete a private repository and its associated images, see Deleting a private repository and any associated images.
Deleting an image that is being used by an existing deployment might cause scale-up, reschedule, or both, to fail. {: attention}
If you want to restore a deleted image, you can list the contents of the trash by running the ibmcloud cr trash-list command and restore a selected image by running the ibmcloud cr image-restore command.
{: tip}
You can't delete images from the trash. Images are stored in the trash for 30 days. You are not billed for any images that are in the trash. {: note}
Where multiple tags exist for the same image digest within a repository, the ibmcloud cr image-rm command removes the underlying image and all its tags. If the same image exists in a different repository or namespace, the copy of the image is not removed. If you want to remove a tag from an image and make sure that the underlying image and any other tags remain in place, see Removing tags from images in your private repository command.
{: tip}
{: #registry_images_remove_cli}
You can delete unwanted images and all their tags from your private {{site.data.keyword.cloud_notm}} repository by using the CLI.
Deleting an image that is being used by an existing deployment might cause scale-up, reschedule, or both, to fail. {: attention}
If you want to restore a deleted image, you can list the contents of the trash by running the ibmcloud cr trash-list command and restore a selected image by running the ibmcloud cr image-restore command.
{: tip}
To delete an image by using the CLI, complete the following steps:
-
Log in to {{site.data.keyword.cloud_notm}} by running the
ibmcloud logincommand. -
To delete an image, run the following command, where
IMAGEis the name of the image that you want to remove, in the formatrepository@digestorrepository:tag. If a tag is not specified in the image name, the image taggedlatestis deleted by default. You can delete multiple images by listing each private {{site.data.keyword.cloud_notm}} registry path in the command with a space between each path.ibmcloud cr image-rm IMAGE
{: pre}
To find the names of your images, run
ibmcloud cr image-list. Combine the content of the Repository column (repository) and Tag column (tag) separated by a colon (:) to create the image name in the formatrepository:tag. To identify your image by digest, run theibmcloud cr image-digestscommand. Combine the content of the Repository column (repository) and the Digest column (digest) separated by an at (@) symbol to create the image name in the formatrepository@digest. If the list images command times out, see Why is it timing out when I list images? for assistance. {: tip} -
Verify that the image was deleted by running the following command, and check that the image does not show in the list.
ibmcloud cr image-list
{: pre}
{: #registry_images_remove_gui}
You can delete unwanted images and all their tags from your private {{site.data.keyword.cloud_notm}} image repository by using the {{site.data.keyword.cloud_notm}} console.
Deleting an image that is being used by an existing deployment might cause scale-up, reschedule, or both, to fail. {: attention}
If you want to restore a deleted image, you can list the contents of the trash by running the ibmcloud cr trash-list command and restore a selected image by running the ibmcloud cr image-restore command.
{: tip}
To delete an image by using the {{site.data.keyword.cloud_notm}} console, complete the following steps:
- Log in to the {{site.data.keyword.cloud_notm}} console https://cloud.ibm.com/login{: external} with your IBMid.
- If you have multiple {{site.data.keyword.cloud_notm}} accounts, from the account menu, select the account and region that you want to use.
- Click the Navigation menu icon, then click Container Registry.
- Click Images. A list of your images is displayed.
- In the row that contains the image that you want to delete, select the checkbox.
- Click Delete Image.
{: #registry_images_list_trash} {: help} {: support}
You can list deleted images that are in the trash and see when they expire.
To find out which images are in the trash, you can use the ibmcloud cr trash-list command. Images are stored in the trash for 30 days.
To list the images in the trash, complete the following steps:
-
Log in to {{site.data.keyword.cloud_notm}} by running the
ibmcloud logincommand. -
List the images in the trash by using one of the following options:
- List all the images in the trash by running the following command:
ibmcloud cr trash-list
{: pre}
- List only the images in the trash for the namespace that you're interested in by running the following command, where
NAMESPACEis your namespace:
ibmcloud cr trash-list --restrict NAMESPACE
{: pre}
{: #registry_images_restore}
You can restore images from the trash. Deleted images are stored in the trash for 30 days.
You can restore an image from the trash by running the ibmcloud cr image-restore command. To find out which images are in the trash, run the ibmcloud cr trash-list command.
You can restore images by running the ibmcloud cr image-restore command. You can use the following options:
REPO@DIGESTthis option restores the digest and all its tags in the repository that aren't already in the live repository. For more information, see Restoring images by digest.REPO:TAGthis option restores the tag. For more information, see Restoring images by tag.
{: #registry_images_restore_digest} {: help} {: support}
When you restore an image by digest, the digest is copied from the trash into your live repository, and all the tags for the digest in the repository are restored. The digest continues to show in the trash because a copy is restored.
To restore an image from the trash by using the digest, complete the following steps:
-
Log in to {{site.data.keyword.cloud_notm}} by running the
ibmcloud logincommand. -
List the images in the trash by running the following command:
ibmcloud cr trash-list
{: pre}
A table is displayed that shows the items in the trash. The table shows the digest, the days until expiry, and the tags for that digest.
-
Note the digest for the image that you want to restore.
-
Run the following command to restore the image to your repository. Where
DNSis the domain name,NAMESPACEis the namespace,REPOis the repository, andDIGESTis the digest of the image that you want to restore.ibmcloud cr image-restore DNS/NAMESPACE/REPO@DIGEST
{: pre}
If some tags aren't restored, see Why aren't all the tags restored when I restore by digest? for assistance. {: tip}
In your live repository, you can pull the image by digest. If you run the
ibmcloud cr image-digestscommand, the image shows in the output. {: tip}
{: #registry_images_restore_tag} {: help} {: support}
When you restore an image by tag, only that specific tag is moved out of the trash into your live repository.
To restore an image from the trash by using a tag, complete the following steps:
-
Log in to {{site.data.keyword.cloud_notm}} by running the
ibmcloud logincommand. -
List the images in the trash by running the following command:
ibmcloud cr trash-list
{: pre}
A table is displayed that shows the items in the trash. The table shows the digest, the days until expiry, and the tags for that digest.
-
For the image that you want to restore, make a note of the digest up to, but not including, the at sign (
@). This part of the digest isDNS/NAMESPACE/REPO, whereDNSis the domain name,NAMESPACEis the namespace, andREPOis the repository. -
For the image that you want to restore, make a note of the tag
TAG. -
Run the following command to restore the image to your repository, where
DNS/NAMESPACE/REPOis the name of the image that you want to restore andTAGis the tag.ibmcloud cr image-restore DNS/NAMESPACE/REPO:TAG
{: pre}
In your live repository, you can pull the image by tag.
If you get an error when you're restoring an image that says that the tagged image exists, see Why do I get an error when I'm restoring an image? for assistance. {: tip}
If you run the
ibmcloud cr trash-listcommand, the digest and any other tags show in the output, but the tag is no longer displayed. {: tip}
{: #registry_repo_remove} {: help} {: support}
You can delete private repositories that are no longer required, and any associated images, by using the {{site.data.keyword.cloud_notm}} console.
When you delete a repository, all images in that repository are deleted. This action can't be undone. {: attention}
Before you begin, you must back up any images that you want to keep. {: important}
To delete a private repository by using the {{site.data.keyword.cloud_notm}} console, complete the following steps:
-
Log in to the {{site.data.keyword.cloud_notm}} console https://cloud.ibm.com/login{: external} with your IBMid.
-
If you have multiple {{site.data.keyword.cloud_notm}} accounts, from the account menu, select the account and region that you want to use.
-
Click the Navigation menu icon, then click Container Registry.
-
Click Repositories. A list of your private repositories is displayed.
-
In the row that contains the private repository that you want to delete, select the checkbox.
Ensure that the correct repository is selected because this action can't be undone. {: attention}
-
Click Delete Repository.