When trying to use an arm-based Docker image with the Docker executor, you may see the following error when trying to use an image built for the wrong architecture:
WARNING: docker image targets wrong architecture (found arm64 but need [amd64 i386 386])
- Solution 1
In order to run arm-based images with the Docker executor, you will need to specify an arm resource class. For a list of available resource classes, please check the following page:
Here is an example using the resource class
version: 2.1 jobs: test: docker: - image: cimg/base:2023.07 resource_class: arm-medium steps: - checkout - run: name: Test command: | echo "test" workflows: arm-workflow: jobs: - test
- Solution 2
Arm-based Docker images can also be executed on the Machine executor by utilizing the command
docker runand passing in the architecture for the
Here is a sample config.yml file showing this implementation using the docker image
ruby:3.2.2-slimwith the Machine executor image
ubuntu-2004:2022.04.1and logging out the architecture:
version: 2.1 jobs: test: machine: image: ubuntu-2004:2022.04.1 resource_class: arm.medium steps: - checkout - run: name: Start arm docker container command: | docker run -idt --platform linux/arm64/v8 --name ruby ruby:3.2.2-slim docker exec -it ruby bash -c "uname -m" workflows: arm-workflow: jobs: - test
The "targets wrong architecture" error should no longer show if the architecture of the image you are trying to run matches the one of the executor specified in your config.yml file.
Please see the following resources for additional information on the Machine executor, and how to work with multi-platform Docker images.