collabnix / collabnix/dockerlabs
[docker] Upgrade labs for cross-platform compatibility
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When running examples/labs for the docker workshop locally people will find that some Dockerfiles won't build because they are targeting a specific arch different than the one the user is running the docker daemon.
I have seen a lot of Dockerfiles targetting, for eg, alpine:3.5 as the base image which is amd64 specific
If you run the build in an arm64v8 arch like myself which I have a Mac you might encounter this compatibility error.
To Reproduce
Steps to reproduce the behavior:
- Check that your running architecture differs from amd64
uname -m // arm64
- Try to build this testing Dockerfile
FROM alpine:3.5
CMD ["/bin/echo", "Works!"]
docker build -t try .
- See error
[+] Building 1.1s (3/3) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 79B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/alpine:3.5 1.0s
------
> [internal] load metadata for docker.io/library/alpine:3.5:
------
Dockerfile:1
--------------------
1 | >>> FROM alpine:3.5
2 | CMD ["/bin/echo","Works!"]
--------------------
ERROR: failed to solve: alpine:3.5: no match for platform in manifest sha256:66952b313e51c3bd1987d7c4ddf5dba9bc0fb6e524eed2448fa660246b3e76ec: not found
Expected behavior
Build should be possible with more archs different than amd64.
There are some images that are multi-arch in the alpine official repo for the case and for the many other OS base-image repos that are used in the workshop.
Proposed solution
For alpine references please use instead apline:3 that targets to alpine:latest which is compatible with 386, amd64 and arm architectures. Proves to work well in my arm64v8 Mac.
Desktop (please complete the following information):
- OS: uname -a
Darwin Demians-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64
Kudos to the creator and contributors of this wonderful workshop!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the Dockerfiles under examples/labs and locating Alpine and other architecture-specific base-image references. Build the affected labs on an arm64 environment and verify that the updated references build successfully across the intended architectures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100