devcontainers / devcontainers/cli

Can't build dev container on D:

Offen
#240 7 Kommentare 8 Reaktionen 1 zugewiesene Person Beansprucht von @chrmarti Auf GitHub ansehen
bug
Vorherrschende Sprache
TypeScript
Sterne
3k
Forks
457
Ø Merge
13 Std. 17 Min.
Gemergte PRs (30 T.)
6

Beschreibung

If `Dockerfile` and `devcontainer.json` in `D:` drive on Windows (that is `D:\.devcontainer\Dockerfile` & `D:\.devcontainer\devcontainer.json`)

`D:\.devcontainer\Dockerfile`

```dockerfile
ARG VARIANT="bullseye"
FROM mcr.microsoft.com/devcontainers/rust:1-${VARIANT}
```

`D:\.devcontainer\devcontainer.json`

```dockerfile
{
"name": "Sample",
"build": {
"dockerfile": "Dockerfile"
}
}
```

Build container with devcontainer will fail:

```sh
# in D:\
devcontainer build .
[18 ms] @devcontainers/cli 0.20.0. Node.js v16.14.2. win32 10.0.22621 x64.
[797 ms] Start: Run: docker build -t dev_container_feature_content_temp -f C:\Users\USER\AppData\Local\Temp\devcontainercli\container-features\0.20.0-1666419425720\Dockerfile.buildContent C:\Users\USER\AppData\Local\Temp\devcontainercli\container-features\0.20.0-1666419425720
[975 ms] Sending build context to Docker daemon 297kB
[1007 ms] Step 1/2 : FROM scratch
--->
Step 2/2 : COPY . /tmp/build-features/
[1007 ms]
[1013 ms] ---> Using cache
[1014 ms] ---> 65d7fa21086a
[1014 ms] Successfully built 65d7fa21086a
[1022 ms] Successfully tagged dev_container_feature_content_temp:latest
[1022 ms] SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
[1027 ms] Start: Run: docker build -f C:\Users\USER\AppData\Local\Temp\devcontainercli\container-features\0.20.0-1666419425720\Dockerfile-with-features -t vsc-vscode-remote-try-rust-2b487e416576759e13404c2a21fd7848 --target dev_containers_target_stage --build-arg VARIANT=bullseye --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp D:\.devcontainer
[1122 ms] unable to prepare context: unable to get relative Dockerfile path: Rel: can't make C:\Users\USER\AppData\Local\Temp\devcontainercli\container-features\0.20.0-1666419425720\Dockerfile-with-features relative to E:\.devcontainer
[1125 ms] Exit code 1
```

Looks like `filepath.Rel` (https://github.com/docker/cli/blob/v20.10.20/cli/command/image/build/context.go#L358) in docker-cli will fail due to devcontainer create Dockerfile-with-features in system drive regardless original workspace.

The devcontainer should create temp files in same drive as workspace instead of just creating in Windows temp.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.