github.com/goreleaser/goreleaser@v1.25.1/www/docs/blog/posts/2022-01-23-docker-manifests.md (about)

     1  ---
     2  date: 2022-01-23
     3  slug: docker-manifests
     4  categories:
     5    - tutorials
     6  authors:
     7    - dirien
     8  ---
     9  
    10  # GoReleaser and Docker Manifests
    11  
    12  Let's see how to create Docker manifests with GoReleaser.
    13  
    14  <!-- more -->
    15  
    16  ### Question:
    17  
    18  Did you know, that you can create Docker Manifest Layer with GoReleaser?
    19  
    20  ### No?
    21  
    22  In this article we will see what Docker Manifests are and how can use them in
    23  GoReleaser to delivery multi-arch builds under one single tag.
    24  
    25  But let us start, with the idea behind Docker Image Manifest.
    26  
    27  ## What are Docker Image Manifests?
    28  
    29  ![Image Manifests](https://github.com/goreleaser/goreleaser/assets/245435/380b4907-8d7f-4704-852d-8142c1212e86)
    30  
    31  <!-- _[Source](https://ownyourbits.com/2019/05/13/building-docker-containers-in-2019/)_ doesn't exist anymole -->
    32  
    33  A Docker manifests describe all the layers inside an image.
    34  And with the help of the manifest we can exact compare two images, independent
    35  from their actual human-readable tag.
    36  
    37  Manifests are expressed in JSON and contain all the information about the
    38  different image layers and the architectures.
    39  
    40  Docker uses then the manifests to work out if an image is compatible with the
    41  current device architecture.
    42  And then uses this particular informations to determine on how to start new
    43  containers.
    44  
    45  Currently the
    46  [manifest schema](https://docs.docker.com/registry/spec/manifest-v2-2)
    47  is at version 2.
    48  
    49  A manifest file will declare its schema version and then a list of manifest
    50  entries available for the image.
    51  The entries will then point to a different variation of the image, such as
    52  **amd64** and **arm64**.
    53  
    54  You can easily view the image manifest using the docker manifest inspect
    55  command.
    56  
    57  This works fine with local images or images stored in a remote registry.
    58  
    59  ```bash
    60  docker manifest inspect <image>:<version>
    61  ```
    62  
    63  ![Example output of the docker manifest inspect command](https://github.com/goreleaser/goreleaser/assets/245435/90b1f47f-8c3f-41dd-962a-7990e14771a9)
    64  _Example output of the docker manifest inspect command_
    65  
    66  ## Multi-Arch Builds and Manifests
    67  
    68  For a long time Docker did not support multiple image architectures.
    69  You could only run images with the same architecture as they where build for.
    70  With the rise of ARM-based machines this was really a limiting factor.
    71  
    72  But with manifests, developers can now support multiple architectures under one
    73  single image tag.
    74  The Docker client itself picks the underlying image version for its particular
    75  platform.
    76  Great and simple!
    77  
    78  **Keep in mind**: There should be no changes, other the target architecture or
    79  operating system in the images.
    80  Do not deliver images with completely different functionality under the same
    81  tag.
    82  
    83  You can read more about docker manifests here:
    84  [https://docs.docker.com/engine/reference/commandline/manifest/](https://docs.docker.com/engine/reference/commandline/manifest/)
    85  
    86  > On side note: docker manifest is still an experimental feature and needs to be
    87  > activated in your Docker client.
    88  
    89  ## GoReleaser
    90  
    91  Now that you know what Docker manifest are, we can give GoReleaser the task of
    92  the heavy lifting and let it create the Docker manifest as part of our release
    93  process.
    94  
    95  All you need to do is to add the `docker_manifests` to your `.goreleaser.yaml`.
    96  The most important part is to map `name_template` to the `image_templates` you
    97  created in the `dockers` step.
    98  
    99  ![Example snippet of a gorelaser.yaml](https://github.com/goreleaser/goreleaser/assets/245435/94f6f3fc-98e0-4d9f-96c0-65851ee07e2f)
   100  _Example snippet of a `.gorelaser.yaml`_
   101  
   102  There are some additional flags you can set, e.g. if you have a self-hosted
   103  Docker registry with self-signed certificates, you can pass the insecure flag.
   104  
   105  Check out the official GoReleaser documentation
   106  [https://goreleaser.com/customization/docker_manifest/](https://goreleaser.com/customization/docker_manifest/)
   107  for an in-depth overview.
   108  
   109  ## Summary
   110  
   111  With GoReleaser its a breeze to create Docker manifest for your multi arch
   112  builds.
   113  Go try it out!
   114  
   115  ![](https://cdn-images-1.medium.com/max/2000/0*2blEBypJ9QRvqDsm.jpg)
   116  
   117  [https://goreleaser.com/](https://goreleaser.com/customization/docker_manifest/)