github.com/ahmet2mir/goreleaser@v0.180.3-0.20210927151101-8e5ee5a9b8c5/www/docs/customization/docker_manifest.md (about) 1 --- 2 title: Docker Manifest 3 --- 4 5 Since [v0.148.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.148.0), 6 GoReleaser supports building and pushing Docker multi-platform images through 7 the `docker manifest` tool. 8 9 For it to work, it [has to be enabled in the client configurations](https://github.com/docker/cli/blob/master/experimental/README.md). 10 11 Please make sure `docker manifest` works before opening issues. 12 13 Notice that if you have something in the `docker_manifests` section in your 14 config file, GoReleaser will add the manifest's to the release notes 15 instead of the Docker images names. 16 17 !!! warning 18 Please note that this is a beta feature, and it may change or be removed 19 at any time. 20 21 ## Customization 22 23 You can create several manifests in a single GoReleaser run, here are all the 24 options available: 25 26 ```yaml 27 # .goreleaser.yml 28 docker_manifests: 29 # You can have multiple Docker manifests. 30 - 31 # ID of the manifest, needed if you want to filter by it later on (e.g. on custom publishers). 32 id: myimg 33 34 # Name template for the manifest. 35 # Defaults to empty. 36 name_template: foo/bar:{{ .Version }} 37 38 # Image name templates to be added to this manifest. 39 # Defaults to empty. 40 image_templates: 41 - foo/bar:{{ .Version }}-amd64 42 - foo/bar:{{ .Version }}-arm64v8 43 44 # Extra flags to be passed down to the manifest create command. 45 # Defaults to empty. 46 create_flags: 47 - --insecure 48 49 # Extra flags to be passed down to the manifest push command. 50 # Defaults to empty. 51 push_flags: 52 - --insecure 53 54 # Skips the Docker manifest. 55 # If you set this to 'false' or 'auto' on your source Docker configs, 56 # you'll probably want to do the same here. 57 # 58 # If set to 'auto', the manifest will not be created in case there is an 59 # indicator of a prerelease in the tag, e.g. v1.0.0-rc1. 60 # 61 # Defaults to false. 62 skip_push: false 63 64 # Set the "backend" for the Docker manifest pipe. 65 # Valid options are: docker, podman 66 # 67 # Relevant notes: 68 # 1. podman is a GoReleaser Pro feature and is only available on Linux; 69 # 2. if you set podman here, the respective docker configs need to use podman too. 70 # 71 # Defaults to docker. 72 use: docker 73 ``` 74 75 !!! tip 76 Learn more about the [name template engine](/customization/templates/). 77 78 ## How it works 79 80 We basically build and push our images as usual, but we also add a new 81 section to our config defining which images are part of which manifests. 82 83 GoReleaser will create and publish the manifest in its publish phase. 84 85 !!! warning 86 Unfortunately, the manifest tool needs the images to be pushed to create 87 the manifest, that's why we both create and push it in the publish phase. 88 89 ## Example config 90 91 In this example we will use Docker's `--platform` option to specify the target platform. 92 This way we can use the same `Dockerfile` for both the `amd64` and the `arm64` 93 images (and possibly others): 94 95 ```dockerfile 96 # Dockerfile 97 FROM alpine 98 ENTRYPOINT ["/usr/bin/mybin"] 99 COPY mybin /usr/bin/mybin 100 ``` 101 102 Then, on our GoReleaser config file, we need to define both the `dockers` and 103 the `docker_manifests` section: 104 105 ```yaml 106 # .goreleaser.yml 107 builds: 108 - env: 109 - CGO_ENABLED=0 110 binary: mybin 111 goos: 112 - linux 113 goarch: 114 - amd64 115 - arm64 116 dockers: 117 - image_templates: 118 - "foo/bar:{{ .Version }}-amd64" 119 use: buildx 120 dockerfile: Dockerfile 121 build_flag_templates: 122 - "--platform=linux/amd64" 123 - image_templates: 124 - "foo/bar:{{ .Version }}-arm64v8" 125 use: buildx 126 goarch: arm64 127 dockerfile: Dockerfile 128 build_flag_templates: 129 - "--platform=linux/arm64/v8" 130 docker_manifests: 131 - name_template: foo/bar:{{ .Version }} 132 image_templates: 133 - foo/bar:{{ .Version }}-amd64 134 - foo/bar:{{ .Version }}-arm64v8 135 ``` 136 137 !!! warning 138 Notice that `--platform` needs to be in the Docker platform format, not Go's. 139 140 That config will build the 2 Docker images defined, as well as the manifest, 141 and push everything to Docker Hub. 142 143 ## Podman 144 145 !!! success "GoReleaser Pro" 146 The podman backend is a [GoReleaser Pro feature](/pro/). 147 148 You can use [`podman`](https://podman.io) instead of `docker` by setting `use` to `podman` on your config: 149 150 ```yaml 151 # .goreleaser.yml 152 docker_manifests: 153 - name_template: foo/bar:{{ .Version }} 154 image_templates: 155 - foo/bar:{{ .Version }}-amd64 156 - foo/bar:{{ .Version }}-arm64v8 157 use: podman 158 ``` 159 160 Note that GoReleaser will not install Podman for you, nor change any of its configuration.