goreleaser: docker build failed: exit status 1: ERROR: use `docker --context=default buildx` to switch to context "default"
What happened?
When I run goreleaser release, the process reaches the section with Docker image creation and an error appears:
docker build failed: failed to build gowebly/gowebly:latest-arm64: exit status 1: ERROR: use `docker --context=default buildx` to switch to context "default"
My .goreleaser.yml:
...
dockers:
-
id: '{{ .ProjectName }}_linux_amd64' # For GNU/Linux x86_64
ids: [ default ]
use: buildx
skip_push: auto
image_templates:
- 'gowebly/{{ .ProjectName }}:latest-linux-amd64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-linux-amd64'
build_flag_templates:
- '--pull'
- '--label=org.opencontainers.image.created={{ .Date }}'
- '--label=org.opencontainers.image.title={{ .ProjectName }}'
- '--label=org.opencontainers.image.revision={{ .FullCommit }}'
- '--label=org.opencontainers.image.version={{ .Version }}'
- '--platform=linux/amd64'
push_flags:
- '--tls-verify=false'
-
id: '{{ .ProjectName }}_linux_arm64' # For GNU/Linux ARM
ids: [ default ]
use: buildx
skip_push: auto
image_templates:
- 'gowebly/{{ .ProjectName }}:latest-linux-arm64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-linux-arm64'
build_flag_templates:
- '--pull'
- '--label=org.opencontainers.image.created={{ .Date }}'
- '--label=org.opencontainers.image.title={{ .ProjectName }}'
- '--label=org.opencontainers.image.revision={{ .FullCommit }}'
- '--label=org.opencontainers.image.version={{ .Version }}'
- '--platform=linux/arm64'
push_flags:
- '--tls-verify=false'
-
id: '{{ .ProjectName }}_darwin_amd64' # For Apple macOS x86_64
ids: [ default ]
use: buildx
skip_push: auto
image_templates:
- 'gowebly/{{ .ProjectName }}:latest-darwin-amd64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-darwin-amd64'
build_flag_templates:
- '--pull'
- '--label=org.opencontainers.image.created={{ .Date }}'
- '--label=org.opencontainers.image.title={{ .ProjectName }}'
- '--label=org.opencontainers.image.revision={{ .FullCommit }}'
- '--label=org.opencontainers.image.version={{ .Version }}'
- '--platform=darwin/amd64'
push_flags:
- '--tls-verify=false'
-
id: '{{ .ProjectName }}_darwin_arm64' # For Apple macOS ARM
ids: [ default ]
use: buildx
skip_push: auto
image_templates:
- 'gowebly/{{ .ProjectName }}:latest-darwin-arm64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-darwin-arm64'
build_flag_templates:
- '--pull'
- '--label=org.opencontainers.image.created={{ .Date }}'
- '--label=org.opencontainers.image.title={{ .ProjectName }}'
- '--label=org.opencontainers.image.revision={{ .FullCommit }}'
- '--label=org.opencontainers.image.version={{ .Version }}'
- '--platform=darwin/arm64'
push_flags:
- '--tls-verify=false'
docker_manifests:
-
name_template: 'gowebly/{{ .ProjectName }}:latest'
skip_push: auto
image_templates:
- 'gowebly/{{ .ProjectName }}:latest-linux-amd64'
- 'gowebly/{{ .ProjectName }}:latest-linux-arm64'
- 'gowebly/{{ .ProjectName }}:latest-darwin-amd64'
- 'gowebly/{{ .ProjectName }}:latest-darwin-arm64'
-
name_template: 'gowebly/{{ .ProjectName }}:{{ .Tag }}'
skip_push: auto
image_templates:
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-linux-amd64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-linux-arm64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-darwin-amd64'
- 'gowebly/{{ .ProjectName }}:{{ .Tag }}-darwin-arm64'
...
How can we reproduce this?
- Clone project https://github.com/gowebly/gowebly
- Run
goreleaser release - See error
goreleaser version
GitVersion: 1.21.2
GitCommit: 26fed97a0defe4e73e3094cb903225d5445e5f0d
GitTreeState: false
BuildDate: 2023-09-26T11:20:15Z
BuiltBy: goreleaser
GoVersion: go1.21.1
Compiler: gc
ModuleSum: h1:dgYtIS7aZlQuRMUMLCjDCOs4lWss85Oh60RDSO0rbWU=
Platform: darwin/arm64
GoReleaser Check
- goreleaser check shows no errors
Search
- I did search for other open and closed issues before opening this
Supporter
Code of Conduct
- I agree to follow this project’s Code of Conduct
Additional context
$ docker-buildx version
github.com/docker/buildx v0.11.2 9872040b6626fb7d87ef7296fd5b832e8cc2ad17
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- fix(docker): remove --builder=default from default args when use=buildx refs #4392 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> — committed to goreleaser/goreleaser by caarlos0 3 years ago
- fix(docker): remove --builder=default from default args when use=buildx (#4566) refs #4392 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> — committed to goreleaser/goreleaser by caarlos0 3 years ago
Or just run
docker context use defaultbefore running GoReleaser.ah, correct… okay, so we’ll need to fix this in another way, will take a proper look later
fixed in #4401, thanks @tcurdt !
maybe we could at least document this better though… if anyone wants to give a swing at PR-ing that 😄
I think I agree, playing with it in https://github.com/goreleaser/goreleaser/pull/4566
I think we could yeah, maybe search for that, and thrown an error with an URL pointing to a better explanation, like this one for example: https://goreleaser.com/errors/dirty/
@dunglas That would be too easy! (embarrassed sarcasm)
Thanks 😃
If the switch is persistent maybe there isn’t much to do in code really.
I think that if you could add
--context=<the context name>tobuild_flag_templatesit would work, but we probably need a better solution