How to start remote-containers (the VScode extension) for a different platform?

Viewed 50

So I have docker environment, and want to use the Remote Containers VScode extension to attach my editor to a container.

But I need to specify the platform while building, otherwise it doesn't work

This build command works:

docker buildx build --file Dockerfile.local --platform linux/amd64 -t webapp . --load

However, when I use "Open folder in container" option from Remote-containers, I found in the build log that it's being started with this command:

docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /Users/macbook/webapp/Dockerfile.local -t vsc-webapp-d6a884082a6b83d4c1a0444e21b1d8e0 /Users/macbook/webapp

So the build Fails.

How can I tell remote-containers to use --platform linux/amd64 while building?

I tried adding this to devcontainer.json and didn't work:

"build": { "args": { "DOCKER_DEFAULT_PLATFORM": "linux/amd64" }}

and

"containerEnv": { "DOCKER_DEFAULT_PLATFORM": "linux/amd64" }

0 Answers
Related