github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/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  # tag
     8  
     9  ```markdown
    10  Usage:  docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
    11  
    12  Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
    13  
    14  Options:
    15        --help   Print usage
    16  ```
    17  
    18  ## Description
    19  
    20  An image name is made up of slash-separated name components, optionally prefixed
    21  by a registry hostname. The hostname must comply with standard DNS rules, but
    22  may not contain underscores. If a hostname is present, it may optionally be
    23  followed by a port number in the format `:8080`. If not present, the command
    24  uses Docker's public registry located at `registry-1.docker.io` by default. Name
    25  components may contain lowercase letters, digits and separators. A separator
    26  is defined as a period, one or two underscores, or one or more dashes. A name
    27  component may not start or end with a separator.
    28  
    29  A tag name must be valid ASCII and may contain lowercase and uppercase letters,
    30  digits, underscores, periods and dashes. A tag name may not start with a
    31  period or a dash and may contain a maximum of 128 characters.
    32  
    33  You can group your images together using names and tags, and then upload them
    34  to [*Share images on Docker Hub*](https://docs.docker.com/get-started/part3/).
    35  
    36  ## Examples
    37  
    38  ### Tag an image referenced by ID
    39  
    40  To tag a local image with ID "0e5574283393" into the "fedora" repository with
    41  "version1.0":
    42  
    43  ```bash
    44  $ docker tag 0e5574283393 fedora/httpd:version1.0
    45  ```
    46  
    47  ### Tag an image referenced by Name
    48  
    49  To tag a local image with name "httpd" into the "fedora" repository with
    50  "version1.0":
    51  
    52  ```bash
    53  $ docker tag httpd fedora/httpd:version1.0
    54  ```
    55  
    56  Note that since the tag name is not specified, the alias is created for an
    57  existing local version `httpd:latest`.
    58  
    59  ### Tag an image referenced by Name and Tag
    60  
    61  To tag a local image with name "httpd" and tag "test" into the "fedora"
    62  repository with "version1.0.test":
    63  
    64  ```bash
    65  $ docker tag httpd:test fedora/httpd:version1.0.test
    66  ```
    67  
    68  ### Tag an image for a private repository
    69  
    70  To push an image to a private registry and not the central Docker
    71  registry you must tag it with the registry hostname and port (if needed).
    72  
    73  ```bash
    74  $ docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
    75  ```