Skip to content

Add a platform property to the devcontainer.json #10757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tylersatre opened this issue Mar 6, 2025 · 7 comments
Closed

Add a platform property to the devcontainer.json #10757

tylersatre opened this issue Mar 6, 2025 · 7 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality

Comments

@tylersatre
Copy link

  • VSCode Version: 1.97.2
  • Local OS Version: macOS 15.3.1
  • Remote OS Version: n/a
  • Remote Extension/Connection Type: Dev Containers/WSL/Remote
  • Logs:
[2025-03-06T20:08:55.500Z] Start: Run: docker -v
[2025-03-06T20:08:55.512Z] Stop (12 ms): Run: docker -v
[2025-03-06T20:08:55.512Z] Start: Resolving Remote
[2025-03-06T20:08:55.514Z] Start: Run: git rev-parse --show-cdup
[2025-03-06T20:08:55.527Z] Stop (13 ms): Run: git rev-parse --show-cdup
[2025-03-06T20:08:55.528Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone --filter label=devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json
[2025-03-06T20:08:55.543Z] Stop (15 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone --filter label=devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json
[2025-03-06T20:08:55.543Z] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04
[2025-03-06T20:08:55.559Z] Stop (16 ms): Run: docker inspect --type image mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04
[2025-03-06T20:08:55.560Z] Resolving Feature dependencies for 'ghcr.io/devcontainers/features/desktop-lite:1'...
[2025-03-06T20:08:55.560Z] * Processing feature: ghcr.io/devcontainers/features/desktop-lite:1
[2025-03-06T20:08:55.561Z] Loading 3 extra certificates from /var/folders/zm/kx6fp0vs24586dxm1x3wmfz40000gn/T/vsch/certificates-0437ad0cc8f53d27e031343e6990ff22153a9b4a364f5f84faf0c6369039dc4f.pem.
[2025-03-06T20:08:55.607Z] Start: Run: docker-credential-osxkeychain get
[2025-03-06T20:08:55.631Z] Stop (24 ms): Run: docker-credential-osxkeychain get
[2025-03-06T20:08:56.017Z] * Processing feature: ghcr.io/devcontainers/features/common-utils
[2025-03-06T20:08:56.279Z] Soft-dependency 'ghcr.io/devcontainers/features/common-utils' is not required.  Removing from installation order...
[2025-03-06T20:08:56.291Z] * Fetching feature: desktop-lite_0_oci
[2025-03-06T20:08:56.477Z] Files to omit: ''
[2025-03-06T20:08:56.487Z] * Fetched feature: desktop-lite_0_oci version 1.2.5
[2025-03-06T20:08:56.492Z] Start: Run: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/zm/kx6fp0vs24586dxm1x3wmfz40000gn/T/devcontainercli/container-features/0.74.0-1741291735559 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04 --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -f /var/folders/zm/kx6fp0vs24586dxm1x3wmfz40000gn/T/devcontainercli/container-features/0.74.0-1741291735559/Dockerfile.extended -t vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features /Users/tyler/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
[2025-03-06T20:08:56.709Z] [+] Building 0.0s (0/1)                                         docker:orbstack
[2025-03-06T20:08:56.709Z] 
[2025-03-06T20:08:56.835Z] [+] Building 0.1s (1/3)                                         docker:orbstack
 => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 2.22kB                                     0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.1s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
[2025-03-06T20:08:56.986Z] [+] Building 0.3s (2/3)                                         docker:orbstack
[2025-03-06T20:08:56.986Z]  => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 2.22kB                                     0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.2s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
[2025-03-06T20:08:57.024Z] [+] Building 0.3s (3/3)                                         docker:orbstack
 => [internal] load build definition from Dockerfile.extended              0.0s
[2025-03-06T20:08:57.024Z]  => => transferring dockerfile: 2.22kB                                     0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.3s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
[2025-03-06T20:08:57.125Z] [+] Building 0.4s (4/5)                                         docker:orbstack
 => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 2.22kB                                     0.0s
[2025-03-06T20:08:57.125Z]  => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.3s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531b  0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context:                                               0.0s
[2025-03-06T20:08:57.304Z] [+] Building 0.6s (6/7)                                         docker:orbstack
 => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 2.22kB                                     0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.3s
[2025-03-06T20:08:57.304Z]  => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531b  0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for mcr.microsoft.com/devcontainers/cpp:ubun  0.2s
 => [context dev_containers_feature_content_source] load .dockerignore     0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
[2025-03-06T20:08:57.358Z] [+] Building 0.6s (7/7)                                         docker:orbstack
 => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 2.22kB                                     0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.3s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531b  0.0s
[2025-03-06T20:08:57.358Z]  => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for mcr.microsoft.com/devcontainers/cpp:ubun  0.2s
 => [context dev_containers_feature_content_source] load .dockerignore     0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
[2025-03-06T20:08:57.512Z] [+] Building 0.8s (16/16) FINISHED                              docker:orbstack
 => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 2.22kB                                     0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1  0.3s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io           0.0s
[2025-03-06T20:08:57.512Z]  => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531b  0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for mcr.microsoft.com/devcontainers/cpp:ubun  0.2s
 => [context dev_containers_feature_content_source] load .dockerignore     0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
 => [dev_containers_target_stage 1/5] FROM mcr.microsoft.com/devcontainer  0.0s
 => [context dev_containers_feature_content_source] load from client       0.0s
 => => transferring dev_containers_feature_content_source: 35.15kB         0.0s
 => CACHED [dev_containers_target_stage 2/5] RUN mkdir -p /tmp/dev-contai  0.0s
 => CACHED [dev_containers_feature_content_normalize 2/3] COPY --from=dev  0.0s
 => CACHED [dev_containers_fe
[2025-03-06T20:08:57.512Z] ature_content_normalize 3/3] RUN chmod -R 07  0.0s
 => CACHED [dev_containers_target_stage 3/5] COPY --from=dev_containers_f  0.0s
 => CACHED [dev_containers_target_stage 4/5] RUN echo "_CONTAINER_USER_HO  0.0s
 => CACHED [dev_containers_target_stage 5/5] RUN --mount=type=bind,from=d  0.0s
 => exporting to image                                                     0.0s
 => => exporting layers                                                    0.0s
 => => writing image sha256:d8bb18249a1b40ffc4ad6f6db4d3f0e317567b53dd1ef  0.0s
 => => naming to docker.io/library/vsc-orcaslicer-ocraftyone-e004526ba36f  0.0s
[2025-03-06T20:08:57.512Z] 
View build details: �]8;;docker-desktop://dashboard/build/orbstack/orbstack/n8dspi3av6wh52si69zastx1j�\docker-desktop://dashboard/build/orbstack/orbstack/n8dspi3av6wh52si69zastx1j�]8;;�\
[2025-03-06T20:08:57.782Z] 
What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview 
[2025-03-06T20:08:57.783Z] Stop (1291 ms): Run: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/zm/kx6fp0vs24586dxm1x3wmfz40000gn/T/devcontainercli/container-features/0.74.0-1741291735559 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04 --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -f /var/folders/zm/kx6fp0vs24586dxm1x3wmfz40000gn/T/devcontainercli/container-features/0.74.0-1741291735559/Dockerfile.extended -t vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features /Users/tyler/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
[2025-03-06T20:08:57.784Z] Start: Run: docker events --format {{json .}} --filter event=start
[2025-03-06T20:08:57.785Z] Start: Starting container
[2025-03-06T20:08:57.785Z] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/Users/tyler/OrcaSlicer-Ocraftyone,target=/workspaces/OrcaSlicer-Ocraftyone,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone -l devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --env-file /tmp/devcontainer.env --platform=linux/amd64 --init --cap-add SYS_PTRACE --security-opt seccomp=unconfined --entrypoint /bin/sh vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features -c echo Container started
[2025-03-06T20:08:57.802Z] Unable to find image 'vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features:latest' locally
[2025-03-06T20:08:58.024Z] docker: Error response from daemon: pull access denied for vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
[2025-03-06T20:08:58.025Z] Stop (240 ms): Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/Users/tyler/OrcaSlicer-Ocraftyone,target=/workspaces/OrcaSlicer-Ocraftyone,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone -l devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --env-file /tmp/devcontainer.env --platform=linux/amd64 --init --cap-add SYS_PTRACE --security-opt seccomp=unconfined --entrypoint /bin/sh vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features -c echo Container started
[2025-03-06T20:08:58.026Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone --filter label=devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json
[2025-03-06T20:08:58.027Z] Stop (243 ms): Run: docker events --format {{json .}} --filter event=start
[2025-03-06T20:08:58.046Z] Stop (20 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone --filter label=devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json
[2025-03-06T20:08:58.047Z] Error: Command failed: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/Users/tyler/OrcaSlicer-Ocraftyone,target=/workspaces/OrcaSlicer-Ocraftyone,consistency=cached --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone -l devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --env-file /tmp/devcontainer.env --platform=linux/amd64 --init --cap-add SYS_PTRACE --security-opt seccomp=unconfined --entrypoint /bin/sh vsc-orcaslicer-ocraftyone-e004526ba36f69a6aa4e56db45621bbfd29668ec17e46d7fc5adf95c30654ee3-features -c echo Container started
[2025-03-06T20:08:58.047Z] trap "exit 0" 15
[2025-03-06T20:08:58.047Z] /usr/local/share/desktop-init.sh
[2025-03-06T20:08:58.047Z] exec "$@"
[2025-03-06T20:08:58.047Z] while sleep 1 & wait $!; do :; done -
[2025-03-06T20:08:58.047Z]     at ytA (/Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:468:1260)
[2025-03-06T20:08:58.047Z]     at bH (/Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:468:1002)
[2025-03-06T20:08:58.048Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2025-03-06T20:08:58.048Z]     at async TtA (/Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:485:3848)
[2025-03-06T20:08:58.048Z]     at async iB (/Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:485:4963)
[2025-03-06T20:08:58.048Z]     at async wrA (/Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:666:203)
[2025-03-06T20:08:58.048Z]     at async DrA (/Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:665:14830)
[2025-03-06T20:08:58.048Z]     at async /Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js:485:1190
[2025-03-06T20:08:58.051Z] Stop (3547 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/tyler/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --docker-compose-path docker compose --container-session-data-folder /tmp/devcontainers-572c0a81-3abc-4c4e-96de-ebc260cb40d21741291733734 --workspace-folder /Users/tyler/OrcaSlicer-Ocraftyone --workspace-mount-consistency cached --gpu-availability detect --id-label devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone --id-label devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2025-03-06T20:08:58.051Z] Exit code 1
[2025-03-06T20:08:58.054Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/tyler/.vscode/extensions/ms-vscode-remote.remote-containers-0.401.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/tyler/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --docker-compose-path docker compose --container-session-data-folder /tmp/devcontainers-572c0a81-3abc-4c4e-96de-ebc260cb40d21741291733734 --workspace-folder /Users/tyler/OrcaSlicer-Ocraftyone --workspace-mount-consistency cached --gpu-availability detect --id-label devcontainer.local_folder=/Users/tyler/OrcaSlicer-Ocraftyone --id-label devcontainer.config_file=/Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/tyler/OrcaSlicer-Ocraftyone/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2025-03-06T20:08:58.054Z] Exit code 1

Steps to Reproduce:

  1. Running an an ARM based Mac use a devcontainer.json like:
{
	"name": "OrcaSlicer",
	"image": "mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04",
	"runArgs": ["--env-file", "/tmp/devcontainer.env", "--platform=linux/amd64"],
	"features": {
            "ghcr.io/devcontainers/features/desktop-lite:1": {
			"password": "orca"
		}
    }
}
  1. Try to start up the devcontainer

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: n/a

The issue here is that when there is something set for features in devcontainer.json before executing the docker run command to start up the container it does docker buildx build to add in the feature. The problem is that the build command does not have the --platform=linux/amd64 flag when building. Then when it does docker run to start up the container that flag is present. Since I'm running on an ARM Mac it is building for the linux/arm64 platform because there is no flag, and when it goes to run it tries to use the image that was built but it was for the wrong platform.

@chrmarti
Copy link
Contributor

You could use a Dockerfile with the "build" property in the devcontainer.json, that will also give you an "options" property under "build" where you can add the platform argument. Could you give that a try?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Mar 10, 2025
@tylersatre
Copy link
Author

You could use a Dockerfile with the "build" property in the devcontainer.json, that will also give you an "options" property under "build" where you can add the platform argument. Could you give that a try?

I can confirm that does work as an alternative. Already had it set up, but wanted to flag the issue since it was a bit unintuitive.

@chrmarti
Copy link
Contributor

"runArgs" can have any options for run. We could add a platform property to the devcontainer.json if this comes up more often.

@chrmarti chrmarti changed the title devcontainers.json "features" option not working with "--platform" in "runArgs" Add a platform property to the devcontainer.json Mar 10, 2025
@chrmarti chrmarti added feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster labels Mar 10, 2025
@vs-code-engineering vs-code-engineering bot added this to the Backlog Candidates milestone Mar 10, 2025
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@DanBradbury
Copy link

"runArgs" can have any options for run. We could add a platform property to the devcontainer.json if this comes up more often.
Coming for our teams as we try to leverage devcontainers with features like postgres and need to specify platform to ensure consistent ruby setups.

adding --platform=linux/amd64 broke the building of the container on the feature because of the build issue described above.

Would ideally just be able to have that option apply to build and have that work out of the box.

Copy link

This feature request has not yet received the 10 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

Copy link

🙁 In the last 60 days, this feature request has received less than 10 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants