This docker tag
command creates a tag for an image. The image with the new tag TARGET_IMAGE
refers to SOURCE_IMAGE
.
$ docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Note: A tag name must be valid ASCII and may contain uppercase and lowercase letters, digits, periods, dashes, and underscores. And it should not start with a period or a dash. Max characters limit is 128.
The following command will tag a local image “httpd” into “ubuntu/httpd:version1.0”
$ docker tag httpd ubuntu/httpd:version1.0
The following will tag a local image “693efac53ebd” into the “ubuntu/httpd:version1.0”.
$ docker tag 693efac53ebd ubuntu/httpd:version1.0
The following will tag a local image with the name “httpd” and tag “dev” **into the “ubuntu/httpd:version1.0.dev”.
$ docker tag httpd:dev ubuntu/httpd:version1.0.dev
When you use a private repository to push an image, you need to tag it with the registry hostname and port(if needed). You can do this in a similar way:
$ docker tag 693efac53ebd myregistryhost:8000/ubuntu/httpd:version1.0