crccheck / docker-hello-world

Hello World web server in under 2 MB
https://hub.docker.com/r/crccheck/hello-world/
167 stars 162 forks source link

Arm64 support for Apple Silicon chip #24

Open j796160836 opened 2 years ago

j796160836 commented 2 years ago

Hi, Please add arm64 support although it's hello world project. Busybox (base image) has support arm64. I think just rebuild it will be ok. Thanks.

$ docker run -d --rm --name web-test -p 80:8000 crccheck/hello-world
Unable to find image 'crccheck/hello-world:latest' locally

latest: Pulling from crccheck/hello-world
e685c5c858e3: Pull complete
7bf3c383dbcd: Pull complete
Digest: sha256:0404ca69b522f8629d7d4e9034a7afe0300b713354e8bf12ec9657581cf59400
Status: Downloaded newer image for crccheck/hello-world:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
2c49f324a4360331017a6fa3b42df665d71b315cd1edc49991446e6a318b696f
crccheck commented 2 years ago

sorry I don't know when I'll be able to get to this. I'm between computers right now and I kind of stopped using Docker CLI

j796160836 commented 2 years ago

I solved in my fork.

https://github.com/j796160836/docker-simple-test-http https://hub.docker.com/r/j796160836/simple-test-http


Here is new build command, you need to install buildx command.

https://docs.docker.com/buildx/working-with-buildx/

  1. Login to docker hub before build.
$ docker login

then enter your credentials.

  1. Build and push to registry, remember specify the architecture. (Don't forget the final dot. 🙂)
$ docker buildx build --push -t crccheck/hello-world:latest --platform linux/amd64,linux/arm64,linux/arm/v7 .

Check your docker hub's page, it will list multiple architecture in list. By the way, don't use docker push command. It will upload only one architecture.

crccheck commented 2 years ago

I ended up installing Rancher Desktop (not Docker Desktop) on my M1 Mac and wasn't able to recreate the problem.

As for Docker Desktop users, maybe I can adjust the CI script to publish a buildx build

cernoel commented 1 year ago

you can try my image cernoel/hello-world:main .. if this works .. @crccheck might pull my changes in the publish.yaml to fix this? .. at least it works in my case for the ampere (arm64) servers.

Huge commented 7 months ago

Notice that if you do not specify the platform, running may still fail. Good way: docker run --platform linux/arm64 -d -p 80:80 j796160836/simple-test-http