microsoft / microsoft/vscode-remote-release

Using an `image` fails when it is available for a different platform

Open
#7,300 0 comments 0 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Oct 7, 2022.

bug containers
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: 1.71.2
  • Local OS Version: MacOS 12.2.1
  • Remote OS Version: N/A
  • Remote Extension/Connection Type: Containers v0.256.0
  • Logs:
[673 ms] Start: Run: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/y5/bn31tpn577ncz9k_8fy16m1w0000gp/T/devcontainercli/container-features/0.19.0-1665076271203 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dlf-devel --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-dragonligandfold-c0a7024afda871749c4cd59b1d52a4d7-features -f /var/folders/y5/bn31tpn577ncz9k_8fy16m1w0000gp/T/devcontainercli/container-features/0.19.0-1665076271203/Dockerfile.extended /Users/kai/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder
[+] Building 1.8s (8/8) FINISHED                                                
 => [internal] load build definition from Dockerfile.extended              0.0s
 => => transferring dockerfile: 457B                                       0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4               0.9s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531b  0.0s
 => [internal] load build definition from Dockerfile.extended              0.0s
 => [internal] load .dockerignore                                          0.0s
 => ERROR [internal] load metadata for docker.io/library/dlf-devel:latest  0.5s
 => [context dev_containers_feature_content_source] load .dockerignore     0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
------
 > [internal] load metadata for docker.io/library/dlf-devel:latest:
------
ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
[2827 ms] Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/var/folders/y5/bn31tpn577ncz9k_8fy16m1w0000gp/T/devcontainercli/container-features/0.19.0-1665076271203 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dlf-devel --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-dragonligandfold-c0a7024afda871749c4cd59b1d52a4d7-features -f /var/folders/y5/bn31tpn577ncz9k_8fy16m1w0000gp/T/devcontainercli/container-features/0.19.0-1665076271203/Dockerfile.extended /Users/kai/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/empty-folder

Steps to Reproduce:

  1. Pull/build an image for a different platform (e.g. linux/amd64 on M1 MacBook), in this example dlf-devel.
  2. Try to use that image in devcontainer.json (by specifying { "image": "dlf-devel" })
  3. Get the error message above.

The issue is that --platform=linux/amd64 needs to be specified to docker buildx build, or it will look for (and fail to find) an image for the host platform. This occurs when using docker buildx build on a Dockerfile that starts with FROM dlf-devel as well.

It can be worked around by specifying an explicit Dockerfile ({ "build": { "dockerfile": "Dockerfile" } }), that starts with FROM --platform linux/amd64 dlf-devel. There doesn't seem to be a way to override the platform when not using an explicit Dockerfile.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.