github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/docs/reference/commandline/tag.md (about)

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