Tags on Docker Hub
Tags let you manage multiple versions of images within a single Docker Hub
repository. By adding a specific :<tag>
to each image, such as
docs/base:testing
, you can organize and differentiate image versions for
various use cases. If no tag is specified, the image defaults to the latest
tag.
Tag a local image
To tag a local image, use one of the following methods:
- When you build an image, use
docker build -t <org-or-user-namespace>/<repo-name>[:<tag>
. - Re-tag an existing local image with
docker tag <existing-image> <org-or-user-namespace>/<repo-name>[:<tag>]
. - When you commit changes, use
docker commit <existing-container> <org-or-user-namespace>/<repo-name>[:<tag>]
.
Then, you can push this image to the repository designated by its name or tag:
$ docker push <org-or-user-namespace>/<repo-name>:<tag>
The image is then uploaded and available for use in Docker Hub.
View repository tags
You can view the available tags and the size of the associated image.
-
Sign in to Docker Hub.
-
Select Repositories.
A list of your repositories appears.
-
Select a repository.
The General page for the repository appears.
-
Select the Tags tab.
You can select a tag's digest to see more details.
Delete repository tags
Only the repository owner or other team members with granted permissions can delete tags.
-
Sign in to Docker Hub.
-
Select Repositories.
A list of your repositories appears.
-
Select a repository.
The General page for the repository appears.
-
Select the Tags tab.
-
Select the corresponding checkbox next to the tags to delete.
-
Select Delete.
A confirmation dialog appears.
-
Select Delete.