How to use “Dev Containers: Clone Repository in Container Volume” in VS Code using a github repository without devcontainer.json file in the repo?

  Kiến thức lập trình

What I did:

  • Create a github repository in advance
  • Open github repo using “Dev Containers: Clone Repository in Container Volume” command
  • Select a container configuration template (I select Dart)
  • Select additional features to install (I tried selecting either dart or none)

After this:

  • I expected: the dev container to use the selected container configuration and open the container. After which I could customize the config and edit the files.
  • What happened: I get the following error in an error window:

“An error occured setting up the container.”

In the logs I see this:

[4201 ms] Start: Run in container: cat /workspaces/dev_container_test/.devcontainer/devcontainer.json 2>/dev/null
[4204 ms] Start: Run in container: cat /workspaces/dev_container_test/.devcontainer.json 2>/dev/null
[4209 ms] Repository Username/dev_container_test has no dev container files.

[129485 ms] Preparing to apply Template 'ghcr.io/devcontainers-community/templates/dart:latest'
[129489 ms] Running Dev Containers CLI:   templates apply --workspace-folder C:UserscustomuserAppDataLocalTemptmp-output-dir-1720614786739 --template-id ghcr.io/devcontainers-community/templates/dart:latest --template-args {} --features [] --tmp-dir C:UserscustomuserAppDataLocalTemptmp-dir-1720614786739 --log-level debug
[129493 ms] Start: Run: C:devMicrosoft VS CodeCode.exe c:Userscustomuser.vscodeextensionsms-vscode-remote.remote-containers-0.375.1distspec-nodedevContainersSpecCLI.js templates apply --workspace-folder C:UserscustomuserAppDataLocalTemptmp-output-dir-1720614786739 --template-id ghcr.io/devcontainers-community/templates/dart:latest --template-args {} --features [] --tmp-dir C:UserscustomuserAppDataLocalTemptmp-dir-1720614786739 --log-level debug
[129907 ms] [2024-07-10T12:33:07.150Z] @devcontainers/cli 0.66.0. Node.js v20.9.0. win32 10.0.19045 x64.
[129918 ms] [2024-07-10T12:33:07.163Z] Loading 53 extra certificates from C:UserscustomuserAppDataLocalTempvschcertificates-a09edf88535bfc058b9a6367e2d368c3949eb42cb388284898baa3485917fe45.pem.
[130166 ms] [2024-07-10T12:33:07.410Z] Start: Run: docker-credential-desktop get
[130312 ms] [2024-07-10T12:33:07.556Z] Stop (146 ms): Run: docker-credential-desktop get
[131361 ms] [2024-07-10T12:33:08.606Z] Could not find templated file '.devcontainer/devcontainer.json'.
[131404 ms] Error: ENOENT: no such file or directory, open 'C:UserscustomuserAppDataLocalTemptmp-output-dir-1720614786739.devcontainerdevcontainer.json'
[131405 ms] Exit code ENOENT

How to solve this without manually adding a devcontainer json?

This is when I try to setup a new project, so it is not regular, but slightly annoying. This way I have to create the devcontainer.json file locally and push it to the repo before I can clone it to a dev container volume.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT