Chapter 6. Image tags overview
An image tag refers to a label or identifier assigned to a specific version or variant of a container image. Container images are typically composed of multiple layers that represent different parts of the image. Image tags are used to differentiate between different versions of an image or to provide additional information about the image.
Image tags have the following benefits:
- Versioning and Releases: Image tags allow you to denote different versions or releases of an application or software. For example, you might have an image tagged as v1.0 to represent the initial release and v1.1 for an updated version. This helps in maintaining a clear record of image versions.
- Rollbacks and Testing: If you encounter issues with a new image version, you can easily revert to a previous version by specifying its tag. This is helpful during debugging and testing phases.
- Development Environments: Image tags are beneficial when working with different environments. You might use a dev tag for a development version, qa for quality assurance testing, and prod for production, each with their respective features and configurations.
- Continuous Integration/Continuous Deployment (CI/CD): CI/CD pipelines often utilize image tags to automate the deployment process. New code changes can trigger the creation of a new image with a specific tag, enabling seamless updates.
- Feature Branches: When multiple developers are working on different features or bug fixes, they can create distinct image tags for their changes. This helps in isolating and testing individual features.
- Customization: You can use image tags to customize images with different configurations, dependencies, or optimizations, while keeping track of each variant.
- Security and Patching: When security vulnerabilities are discovered, you can create patched versions of images with updated tags, ensuring that your systems are using the latest secure versions.
- Dockerfile Changes: If you modify the Dockerfile or build process, you can use image tags to differentiate between images built from the previous and updated Dockerfiles.
Overall, image tags provide a structured way to manage and organize container images, enabling efficient development, deployment, and maintenance workflows.
6.1. Viewing image tag information by using the UI
Use the following procedure to view image tag information using the v2 UI.
Prerequisites
- You have pushed an image tag to a repository.
Procedure
- On the v2 UI, click Repositories.
- Click the name of a repository.
Click the name of a tag. You are taken to the Details page of that tag. The page reveals the following information:
- Name
- Repository
- Digest
- Vulnerabilities
- Creation
- Modified
- Size
- Labels
- How to fetch the image tag
- Click Security Report to view the tag’s vulnerabilities. You can expand an advisory column to open up CVE data.
- Click Packages to view the tag’s packages.
- Click the name of the repository to return to the Tags page.
6.2. Adding a new image tag to an image by using the UI
You can add a new tag to an image in Quay.io.
Procedure
- On the Red Hat Quay v2 UI dashboard, click Repositories in the navigation pane.
- Click the name of a repository that has image tags.
- Click the menu kebab, then click Add new tag.
Enter a name for the tag, then, click Create tag.
The new tag is now listed on the Repository Tags page.
6.3. Adding and managing labels by using the UI
Administrators can add and manage labels for tags by using the following procedure.
Procedure
- On the v2 UI dashboard, click Repositories in the navigation pane.
- Click the name of a repository that has image tags.
- Click the menu kebab for an image and select Edit labels.
- In the Edit labels window, click Add new label.
Enter a label for the image tag using the
key=value
format, for example,com.example.release-date=2023-11-14
.NoteThe following error is returned when failing to use the
key=value
format:Invalid label format, must be key value separated by =
.- Click the whitespace of the box to add the label.
- Optional. Add a second label.
-
Click Save labels to save the label to the image tag. The following notification is returned:
Created labels successfully
. -
Optional. Click the same image tag’s menu kebab
Edit labels X on the label to remove it; alternatively, you can edit the text. Click Save labels. The label is now removed or edited.
6.4. Setting tag expirations
Image tags can be set to expire from a Quay.io repository at a chosen date and time using the tag expiration feature. This feature includes the following characteristics:
- When an image tag expires, it is deleted from the repository. If it is the last tag for a specific image, the image is also set to be deleted.
- Expiration is set on a per-tag basis. It is not set for a repository as a whole.
- After a tag is expired or deleted, it is not immediately removed from the registry. This is contingent upon the allotted time designed in the time machine feature, which defines when the tag is permanently deleted, or garbage collected. By default, this value is set at 14 days, however the administrator can adjust this time to one of multiple options. Up until the point that garbage collection occurs, tags changes can be reverted.
Tag expiration can be set up in one of two ways:
-
By setting the
quay.expires-after=
label in the Dockerfile when the image is created. This sets a time to expire from when the image is built. By selecting an expiration date on the Quay.io UI. For example:
Setting tag expirations can help automate the cleanup of older or unused tags, helping to reduce storage space.
6.4.1. Setting tag expiration from a repository
Procedure
- On the Red Hat Quay v2 UI dashboard, click Repositories in the navigation pane.
- Click the name of a repository that has image tags.
- Click the menu kebab for an image and select Change expiration.
-
Optional. Alternatively, you can bulk add expiration dates by clicking the box of multiple tags, and then select Actions
Set expiration. -
In the Change Tags Expiration window, set an expiration date, specifying the day of the week, month, day of the month, and year. For example,
Wednesday, November 15, 2023
. Alternatively, you can click the calendar button and manually select the date. -
Set the time, for example,
2:30 PM
. -
Click Change Expiration to confirm the date and time. The following notification is returned:
Successfully set expiration for tag test to Nov 15, 2023, 2:26 PM
. On the Red Hat Quay v2 UI Tags page, you can see when the tag is set to expire. For example:
6.4.2. Setting tag expiration from a Dockerfile
You can add a label, for example, quay.expires-after=20h
to an image tag by using the docker label
command to cause the tag to automatically expire after the time that is indicated. The following values for hours, days, or weeks are accepted:
-
1h
-
2d
-
3w
Expiration begins from the time that the image is pushed to the registry.
Procedure
Enter the following
docker label
command to add a label to the desired image tag. The label should be in the formatquay.expires-after=20h
to indicate that the tag should expire after 20 hours. Replace 20h with the desired expiration time. For example:$ docker label quay.expires-after=20h quay-server.example.com/quayadmin/<image>:<tag>
6.5. Fetching an image by tag or digest
Quay.io offers multiple ways of pulling images using Docker and Podman clients.
Procedure
- Navigate to the Tags page of a repository.
- Under Manifest, click the Fetch Tag icon.
When the popup box appears, users are presented with the following options:
- Podman Pull (by tag)
- Docker Pull (by tag)
- Podman Pull (by digest)
Docker Pull (by digest)
Selecting any one of the four options returns a command for the respective client that allows users to pull the image.
Click Copy Command to copy the command, which can be used on the command-line interface (CLI). For example:
$ podman pull quay.io/quayadmin/busybox:test2
6.6. Viewing Red Hat Quay tag history by using the UI
Quay.io offers a comprehensive history of images and their respective image tags.
Procedure
- On the Red Hat Quay v2 UI dashboard, click Repositories in the navigation pane.
- Click the name of a repository that has image tags.
Click Tag History. On this page, you can perform the following actions:
- Search by tag name
- Select a date range
- View tag changes
- View tag modification dates and the time at which they were changed
6.7. Deleting an image tag
Deleting an image tag removes that specific version of the image from the registry.
To delete an image tag, use the following procedure.
Procedure
-
On the Repositories page of the v2 UI, click the name of the image you want to delete, for example,
quay/admin/busybox
. - Click the More Actions drop-down menu.
Click Delete.
NoteIf desired, you could click Make Public or Make Private.
- Type confirm in the box, and then click Delete.
After deletion, you are returned to the Repositories page.
NoteDeleting an image tag can be reverted based on the amount of time allotted assigned to the time machine feature. For more information, see "Reverting tag changes".
6.8. Reverting tag changes by using the UI
Quay.io offers a comprehensive time machine feature that allows older images tags to remain in the repository for set periods of time so that they can revert changes made to tags. This feature allows users to revert tag changes, like tag deletions.
Procedure
- On the Repositories page of the v2 UI, click the name of the image you want to revert.
- Click the Tag History tab.
- Find the point in the timeline at which image tags were changed or removed. Next, click the option under Revert to restore a tag to its image.