Low Orbit Flux Logo 2 F

Docker How To Tag An Image

You can tag a Docker image with a command like this:



docker tag my_image my_image:v1

The general usage looks like this:



docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

NOTE:

Docker Tagging Examples

Specify source repo and dest repo/tag:



docker tag httpd my_image:v1

Specify source repo and dest repo ( default tag will be “latest” for both ):



docker tag httpd my_image

Specify source image ID and dest repo/tag:



docker tag eb600fbda687 my_image:v2

Specify repo/tag for both source and dest:



docker tag my_image:v1 my_image:v2

Basically create another repo name to refer to the same thing ( tag still defaults to latest ):



docker tag my_image other_image

Tag an image with a full destination name:



docker tag eb600fbda687 customregistryhost:5001/repo1/my_image:v1.2.3

Image Naming Details

I generallly just specify the repo when working with images.

A full image name can be specified like this:



[HOST[:PORT_NUMBER]/]PATH

The path is composed of a namespace and repo like this:



[NAMESPACE/]REPOSITORY

The whole thing including the tag would take this format:



[HOST[:PORT_NUMBER]/][NAMESPACE/]REPOSITORY:tag

An actual full example would look like this:



registry-1.docker.io:8080/fedora/httpd:version1.0