devcontainers / devcontainers/cli

Can't build dev container on D:

未关闭
#240 7 条评论 8 个 reaction 已指派 1 人 已被 @chrmarti 认领 在 GitHub 查看
bug
主要语言
TypeScript
星标
3k
派生
457
平均合并
13 小时 17 分钟
30 天内合并 PR
6

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。