devpod icon indicating copy to clipboard operation
devpod copied to clipboard

Can not pull docker.io/library/devcontainer:latest

Open MimeLyc opened this issue 1 year ago • 1 comments

What happened?
I wanted to dev runc in a devcontainer, so I added such devcontainer.json content to it:

{
  "name": "runc",
  "build": {
    "context": "..",
    "dockerfile": "../Dockerfile",
    "target": "devcontainer"
  },
  "workspaceFolder": "/go/src/github.com/opencontainers/runc",
  "workspaceount": "source=${localWorkspaceFolder},target=/go/src/github.com/opencontainers/runc,type=bind,consistency=cached",
  "remoteUser": "root",
  "runArgs": ["--privileged"],
  "customizations": {
    "vscode": {
      "extensions": ["golang.go"]
    }
  },
  "settings": {
    "go.toolsEnvVars": {
      "GOOS": "linux",
      "GOARCH": "amd64"
    }
  },
  "features": {
    "ghcr.io/devcontainers/features/git:1": {
      "version": "latest",
      "ppa": "false"
    },
    "ghcr.io/devcontainers/features/nix:1": {}
  }
}

Then I executed devpod up . --provider docker --dotfiles [email protected]:MimeLyc/${my private dotfile repo} and get the following error:

00:59:11 info #6 ERROR: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
00:59:12 info ------
00:59:12 info > [internal] load metadata for docker.io/library/devcontainer:latest:
00:59:12 info ------
00:59:12 info Dockerfile-with-features:77
00:59:12 info --------------------
00:59:12 info 75 |     ENTRYPOINT [ "/prepare-cgroup-v2.sh" ]
00:59:12 info 76 |
00:59:12 info 77 | >>> FROM $_DEV_CONTAINERS_BASE_IMAGE AS dev_containers_target_stage
00:59:12 info 78 |
00:59:12 info 79 |     USER root
00:59:12 info --------------------
00:59:12 info ERROR: failed to solve: failed to resolve source metadata for docker.io/library/devcontainer:latest: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

What did you expect to happen instead?
Successfully create the devcontainer.

How can we reproduce the bug? (as minimally and precisely as possible)

  1. git clone https://github.com/opencontainers/runc.git
  2. Mkdir .devcontainer and enter it.
  3. Create devcontainer.json file and fill with above content.
  4. devpod up . --provider docker --dotfiles {some dot file repo}

Local Environment:

  • DevPod Version: v0.5.19
  • Operating System: mac
  • ARCH of the OS: ARM64

DevPod Provider:

  • Local/remote provider: docker

Anything else we need to know?
I can make it with the same command for the moby project. And I can pull some public images like nginx.

MimeLyc avatar Aug 08 '24 17:08 MimeLyc

Tks for replying @camrionnvmff

Use the correct base image

The docker.io/library/devcontainer seems to be used in the Dockerfile generated by DevPod, and I have no idea about how to modify it.

docker login docker pull nginx Confirm DevPod configuration or version

I have tried these methods and related info are included in the pr body.

MimeLyc avatar Aug 12 '24 05:08 MimeLyc

@MimeLyc I believe the issue is the build target you have specified in devcontainer.json. According to the docs this defines the build target to pass to the build command, i.e. docker build --target devcontainer. Looking at runc's Dockerfile there is no such target named "devcontainer". Testing on my machine removing the "target" attribute from your build devcontainer.json works.

Let me know if this fixes your issue :)

bkneis avatar Aug 13 '24 13:08 bkneis

@bkneis World saved! You're my hero!

MimeLyc avatar Aug 13 '24 14:08 MimeLyc