Open Maddog2050 opened 3 weeks ago
The module passes that information on to the Docker daemon. If you get an error, then that's because the Docker daemon doesn't handle it as you expect.
Also you might want to use the community.docker.docker_image_build
module, which uses the docker buildx
CLI tool. I think it has better support for other platforms.
SUMMARY
I'm having a problem building an image using docker_image for amd64 on my M1 Mac when using Ansible Molecule. I have replicated what the Docker Molecule plugin does into a simplified playbook and still get the same error.
ISSUE TYPE
COMPONENT NAME
docker_image
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Apple M1 Max, Sequoia 15.1, Python 3.11.10
STEPS TO REPRODUCE
Run the following commands after creating the playbook.yml and Dockerfile below.
Playbook
Dockerfile
EXPECTED RESULTS
I expect that it successfully builds an amd64 image using the Dockerfile.
ACTUAL RESULTS
The playbook fails to build the Docker image and errors out reporting that it can't find the arm64 version of the Docker image.
The digests for the images from Docker hub are as follows:
As you can see at the bottom of the output it's failing to get the arm64 version of the image and failing when this should be the amd64 version of the image as the platform is defined as linux/amd64.