I'm using a MacBook Pro with the M2 processor (arm64) but I need to start a devcontainer with an amd64 version of the Python image (buster):
Docker image: mcr.microsoft.com/devcontainers/python:0-3.11-buster
This is what I've tried so far:
platform in the DockerfileFROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
DOCKER_DEFAULT_PLATFORM environment variable in .zshrcDOCKER_DEFAULT_PLATFORM=linux/amd64
runArgs in devcontainer.json "runArgs": [
"--platform=linux/amd64"
],
But for all of them I receive the following error when building the container:
[183642 ms] Start: Run: docker inspect --type image mcr.microsoft.com/vscode/devcontainers/python:3.11-buster
[185190 ms] Error fetching image details: No manifest found for mcr.microsoft.com/vscode/devcontainers/python:3.11-buster.
[185190 ms] Start: Run: docker pull mcr.microsoft.com/vscode/devcontainers/python:3.11-buster
3.11-buster: Pulling from vscode/devcontainers/python
no matching manifest for linux/arm64/v8 in the manifest list entries
[186436 ms] []
[186436 ms] Error response from daemon: No such image: mcr.microsoft.com/vscode/devcontainers/python:3.11-buster
How can I fix the platform to linux/amd64?
In my case, I could not use runArgs in the devcontainer.json because we are using dockerComposeFile.
The solution was to configure the per-service platform inside the relevant docker-compose.yml, e.g.:
version: "3"
services:
some-service-only-as-amd64:
platform: linux/amd64
build:
context: .
dockerfile: Dockerfile
ports:
- 5000:5000
volumes:
# ... and so on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With