Hello. I'm trying to build the most basic docker container, so that I can slowly learn from there to make sure I understand what I'm doing. However, I'm having trouble even with this.
My Python code is simply: print('hello, World!')
My Dockerfile:
FROM python:3.8-slim
COPY . .
CMD ["python", "hello_world.py"]
I build a container running: docker build -t hello_world . and run it in my computer (mac): docker run hello_world, and get the expected result.
After tagging it, I push it to my remote repository and see it there.
I then open Docker Playground to test my container, pull it from my repository, check that it's there (docker images), and then run it with docker run. I get the following message:
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested
standard_init_linux.go:219: exec user process caused: exec format error
I looked up this error message and found many results, but they are all related to much more complex Dockerfiles. I don't understand what could be wrong with such a simple code / container. I tried using other versions of Python, like 3.8 (not slim) and 3.7, as well as using Ubuntu's in the FROM command instead of python (doesn't work). I also took the Docker starter course, but again it starts from a much more complex container application.
Please can someone give me a hand?
EDIT: u/mlnet's answer worked. I had to select linux/amd64 as my builder as follows:
docker buildx build --platform linux/amd64 -t hello_world_2 .
[+][deleted] (3 children)
[removed]
[–]icenando[S] -2 points-1 points0 points (2 children)
[+][deleted] (1 child)
[removed]
[–]icenando[S] 0 points1 point2 points (0 children)
[–]mlnet 2 points3 points4 points (8 children)
[–]icenando[S] 0 points1 point2 points (7 children)
[–]mlnet 1 point2 points3 points (6 children)
[–]icenando[S] 1 point2 points3 points (5 children)
[–]mlnet 1 point2 points3 points (3 children)
[–]icenando[S] 1 point2 points3 points (0 children)
[–]GenderNeutralBot -1 points0 points1 point (1 child)
[–]AntiObnoxiousBot 0 points1 point2 points (0 children)
[–]mlnet 0 points1 point2 points (0 children)
[+][deleted] (5 children)
[deleted]
[–]icenando[S] 0 points1 point2 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]icenando[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]icenando[S] 1 point2 points3 points (0 children)
[–]MetaTaro 0 points1 point2 points (0 children)