question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crossbuilding docker image for different architectures

See original GitHub issue

Content & configuration

Docker image should work on most common processor architectures.

Is your feature request related to a problem?

The image only works on the architecture with which it was built. Now docker image only works on x86-64 (maybe only x64). Docker image not working on Raspberry PI at least.

➜  ~ arch
armv7l
➜  ~ docker run -it swaggerapi/swagger-ui sh
standard_init_linux.go:211: exec user process caused "exec format error"
➜  ~ arch 
x86_64
➜  ~ docker run -it swaggerapi/swagger-ui sh -c "echo 'works well'"
works well

Describe the solution you’d like

Something like

docker buildx build \
  --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \
  --output "type=image,push=false" \
  --file ./Dockerfile \
  --pull \
  --tag swaggerapi/swagger-ui:latest \
  .

Describe alternatives you’ve considered

https://docs.docker.com/engine/reference/commandline/manifest_create/

Additional context

docker buildx imagetools inspect nginx:1.17-alpine Base image works on linux/amd64, linux/arm/v6, linux/arm64/v8, linux/386, linux/ppc64le, linux/s390x. Swagger UI image not event annotated docker buildx imagetools inspect swaggerapi/swagger-ui

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:19
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
Pentushacommented, Feb 2, 2020

I wrote Github Actions pipeline for crossbuilding swagger-ui image to 386, amd64, arm/v6, arm/v7, arm64, s390x architectures. https://github.com/Pentusha/swagger-ui/blob/master/.github/workflows/docker_crossbuild.yml It publish result images to Docker Hub: https://hub.docker.com/repository/docker/pentusha/swagger-ui-crossbuild/general Its works fine on my raspberry pi 4.

arch; docker run -it pentusha/swagger-ui-crossbuild:latest sh -c 'echo "works well"'
armv7l
works well

Maybe you could include this build steps to your Jenkins pipelines.

11reactions
FZhgcommented, Sep 29, 2021

Really love to see linux arm64 support. Since I am using an M1 macbook.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-arch build and images, the simple way
The question is now, how can we put multiple Docker images, each supporting a different architecture, behind the sametag?
Read more >
Cross building ARM images on Docker Desktop
Now it's possible to cross-build Docker images for multiple architectures using Docker Desktop. Docker desktop is currently the best option for developers to ......
Read more >
Cross Building and Running Multi-Arch Docker Images
Cross-building is defined as building a foreign architecture image different from the hosts architecture, such as building a armhf image on ...
Read more >
Cross build your docker images
Using a stage in Dockerfile to cross-compile to different architectures. We'll focus on the first option, cross building with emulation. docker ...
Read more >
Building Windows multi-arch container images on Linux
All other instructions can be used like normally. Most Dockerfiles for Windows images can be refactored to benefit from cross-building. The idea ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found