github.com/olljanat/moby@v1.13.1/docs/reference/commandline/tag.md (about)

     1  ---
     2  title: "tag"
     3  description: "The tag command description and usage"
     4  keywords: "tag, name, image"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # tag
    17  
    18  ```markdown
    19  Usage:  docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
    20  
    21  Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
    22  
    23  Options:
    24        --help   Print usage
    25  ```
    26  
    27  An image name is made up of slash-separated name components, optionally prefixed
    28  by a registry hostname. The hostname must comply with standard DNS rules, but
    29  may not contain underscores. If a hostname is present, it may optionally be
    30  followed by a port number in the format `:8080`. If not present, the command
    31  uses Docker's public registry located at `registry-1.docker.io` by default. Name
    32  components may contain lowercase characters, digits and separators. A separator
    33  is defined as a period, one or two underscores, or one or more dashes. A name
    34  component may not start or end with a separator.
    35  
    36  A tag name may contain lowercase and uppercase characters, digits, underscores,
    37  periods and dashes. A tag name may not start with a period or a dash and may
    38  contain a maximum of 128 characters.
    39  
    40  You can group your images together using names and tags, and then upload them
    41  to [*Share Images via Repositories*](https://docs.docker.com/engine/tutorials/dockerrepos/#/contributing-to-docker-hub).
    42  
    43  # Examples
    44  
    45  ## Tagging an image referenced by ID
    46  
    47  To tag a local image with ID "0e5574283393" into the "fedora" repository with
    48  "version1.0":
    49  
    50      docker tag 0e5574283393 fedora/httpd:version1.0
    51  
    52  ## Tagging an image referenced by Name
    53  
    54  To tag a local image with name "httpd" into the "fedora" repository with
    55  "version1.0":
    56  
    57      docker tag httpd fedora/httpd:version1.0
    58  
    59  Note that since the tag name is not specified, the alias is created for an
    60  existing local version `httpd:latest`.
    61  
    62  ## Tagging an image referenced by Name and Tag
    63  
    64  To tag a local image with name "httpd" and tag "test" into the "fedora"
    65  repository with "version1.0.test":
    66  
    67      docker tag httpd:test fedora/httpd:version1.0.test
    68  
    69  ## Tagging an image for a private repository
    70  
    71  To push an image to a private registry and not the central Docker
    72  registry you must tag it with the registry hostname and port (if needed).
    73  
    74      docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0