!Cheet Sheet

Cheet Sheet

Tag a Docker Image

These command works for Windows and Linux. You should add SUDO before each command if using Linux.

Tag your local Docker image with the repository name where you want to push it. The general format for tagging an image is:

docker tag [SOURCE_IMAGE] [TARGET_REPOSITORY]:[TAG]

[SOURCE_IMAGE]: This is the name of the image you want to tag, which you have locally. [TARGET_REPOSITORY]: This is the repository where you want to push the image. It could be on Docker Hub, Azure Container Registry, or another registry. [TAG]: This is the tag you want to assign to the image, like latest, v1, v2, etc.

For example, if you have a local image named myapp, and you want to push it to Azure Container Registry, it will look something like this:

docker tag myapp myregistry.azurecr.io/myapp:v1

Push the Image to the Registry

After tagging, you can push the image to the registry:

docker push [TARGET_REPOSITORY]:[TAG]

Using the example, this command pushes the image

docker push myregistry.azurecr.io/myapp:v1

List Repositories in ACR

Once logged in, you can list all repositories in your ACR using the following command. Replace with the name of your Azure Container Registry:

az acr repository list --name <acrName> --output table

List Tags for Each Repository

To list the tags for a specific repository, use the following command. Replace with your ACR name and with the name of the repository for which you want to list the tags:

az acr repository show-tags --name <acrName> --repository <repositoryName> --output table
Last modified July 21, 2024: update (e2ae86c)