github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/man/docker-tag.1.md (about) 1 % DOCKER(1) Docker User Manuals 2 % Docker Community 3 % JUNE 2014 4 # NAME 5 docker-tag - Create a tag `TARGET_IMAGE` that refers to `SOURCE_IMAGE` 6 7 # SYNOPSIS 8 **docker tag** 9 [**--help**] 10 SOURCE_NAME[:TAG] TARGET_NAME[:TAG] 11 12 # DESCRIPTION 13 Assigns a new alias to an image in a registry. An alias refers to the 14 entire image name including the optional `TAG` after the ':'. 15 16 # "OPTIONS" 17 **--help** 18 Print usage statement. 19 20 **NAME** 21 The image name which is made up of slash-separated name components, 22 optionally prefixed by a registry hostname. The hostname must comply with 23 standard DNS rules, but may not contain underscores. If a hostname is 24 present, it may optionally be followed by a port number in the format 25 `:8080`. If not present, the command uses Docker's public registry located at 26 `registry-1.docker.io` by default. Name components may contain lowercase 27 characters, digits and separators. A separator is defined as a period, one or 28 two underscores, or one or more dashes. A name component may not start or end 29 with a separator. 30 31 **TAG** 32 The tag assigned to the image to version and distinguish images with the same 33 name. The tag name may contain lowercase and uppercase characters, digits, 34 underscores, periods and dashes. A tag name may not start with a period or a 35 dash and may contain a maximum of 128 characters. 36 37 # EXAMPLES 38 39 ## Tagging an image referenced by ID 40 41 To tag a local image with ID "0e5574283393" into the "fedora" repository with 42 "version1.0": 43 44 docker tag 0e5574283393 fedora/httpd:version1.0 45 46 ## Tagging an image referenced by Name 47 48 To tag a local image with name "httpd" into the "fedora" repository with 49 "version1.0": 50 51 docker tag httpd fedora/httpd:version1.0 52 53 Note that since the tag name is not specified, the alias is created for an 54 existing local version `httpd:latest`. 55 56 ## Tagging an image referenced by Name and Tag 57 58 To tag a local image with name "httpd" and tag "test" into the "fedora" 59 repository with "version1.0.test": 60 61 docker tag httpd:test fedora/httpd:version1.0.test 62 63 ## Tagging an image for a private repository 64 65 To push an image to a private registry and not the central Docker 66 registry you must tag it with the registry hostname and port (if needed). 67 68 docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0 69 70 # HISTORY 71 April 2014, Originally compiled by William Henry (whenry at redhat dot com) 72 based on docker.com source material and internal work. 73 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 74 July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 75 April 2015, updated by Mary Anthony for v2 <mary@docker.com> 76 June 2015, updated by Sally O'Malley <somalley@redhat.com>