github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/man/src/image/tag.md (about) 1 Assigns a new alias to an image in a registry. An alias refers to the 2 entire image name including the optional `TAG` after the ':'. 3 4 # OPTIONS 5 **NAME** 6 The image name which is made up of slash-separated name components, 7 optionally prefixed by a registry hostname. The hostname must comply with 8 standard DNS rules, but may not contain underscores. If a hostname is 9 present, it may optionally be followed by a port number in the format 10 `:8080`. If not present, the command uses Docker's public registry located at 11 `registry-1.docker.io` by default. Name components may contain lowercase 12 letters, digits and separators. A separator is defined as a period, one or 13 two underscores, or one or more dashes. A name component may not start or end 14 with a separator. 15 16 **TAG** 17 The tag assigned to the image to version and distinguish images with the same 18 name. The tag name must be valid ASCII and may contain lowercase and 19 uppercase letters, digits, underscores, periods and hyphens. A tag name 20 may not start with a period or a hyphen and may contain a maximum of 128 21 characters. 22 23 # EXAMPLES 24 25 ## Tagging an image referenced by ID 26 27 To tag a local image with ID "0e5574283393" into the "fedora" repository with 28 "version1.0": 29 30 docker image tag 0e5574283393 fedora/httpd:version1.0 31 32 ## Tagging an image referenced by Name 33 34 To tag a local image with name "httpd" into the "fedora" repository with 35 "version1.0": 36 37 docker image tag httpd fedora/httpd:version1.0 38 39 Note that since the tag name is not specified, the alias is created for an 40 existing local version `httpd:latest`. 41 42 ## Tagging an image referenced by Name and Tag 43 44 To tag a local image with name "httpd" and tag "test" into the "fedora" 45 repository with "version1.0.test": 46 47 docker image tag httpd:test fedora/httpd:version1.0.test 48 49 ## Tagging an image for a private repository 50 51 Before pushing an image to a private registry and not the central Docker 52 registry you must tag it with the registry hostname and port (if needed). 53 54 docker image tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0