devcontainers / devcontainers/community

unknown flag: --platform linux/amd64

Open
#183 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### Discussed in https://github.com/orgs/devcontainers/discussions/182

Originally posted by **sauberdev** December 3, 2024
Hello all,

I'm trying to use dev containers extension in VS code and I have encountered an issue and not sure how to resolve that. I'm using MacBook M4 for development and I need to build a C++ project in a docker container. However, because some tools I use are not available for ARM platform, I have to build AMD64 container.

I'm able to build it manually and it works fine. However, when I try to build it using .devcontainer.json, I get an error that platform flag is unknown.

Here is a config what I'm using:
```
{
"name": "Ubuntu",
"initializeCommand": "export DOCKER_DEFAULT_PLATFORM=linux/amd64",
"build": {
"dockerfile": "Dockerfile",
"options": ["--platform linux/amd64"]
},
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools"
],
}
```

When I trigger rebuild command, I get the following:

```
Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/tc/cm00y_n96yn3q619t2cvtdrc0000gn/T/devcontainercli/container-features/0.71.0-1733226663215/Dockerfile-with-features -t vsc-test-f97d6391aa323a25664fe9ca89456bc9934932ebb4af40644b657e242211331b --target dev_containers_target_stage --platform linux/amd64 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/test/Documents/test/.devcontainer
[2024-12-03T11:51:03.266Z] unknown flag: --platform linux/amd64
See 'docker buildx build --help'.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.