Skip to content

unknown flag: --platform linux/amd64 #183

@sauberdev

Description

@sauberdev

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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions