devcontainers / devcontainers/cli

devcontainer up fails with unclear error when specifying non-existent remoteUser

Đang mở
#990 0 bình luận 2 reaction 1 người được giao Được @v-Kaniska244 nhận Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
3k
Fork
457
Merge trung bình
13 giờ 17 phút
Pull request đã merge (30 ngày)
6

Mô tả

When creating a devcontainer with a removeUser that does not exist in the container, `devcontainer up` fails without a clear error

The log output contains
```
Shell server terminated (code: 126, signal: null)
no users found
```
for one of the commands and exits with a generic error message in the final result. We use `--log-format=json`, and those lines are plain text, so aren't getting parsed and shown in the build output

## To reproduce

Can reproduce with the following `devcontainer.json`:

```
{
"image": "mcr.microsoft.com/vscode/devcontainers/python:3.10-bullseye",
"remoteUser": "foobar"
}
```

Logs:

```
$ devcontainer up --workspace-folder . --config .devcontainer/devcontainer.json --log-format=json
...
{"type":"start","level":2,"timestamp":1744618710700,"text":"Run: docker inspect --type container 240a168268e3"}
{"type":"stop","level":2,"timestamp":1744618710714,"text":"Run: docker inspect --type container 240a168268e3","startTimestamp":1744618710700}
{"type":"start","level":2,"timestamp":1744618710715,"text":"Inspecting container"}
{"type":"start","level":2,"timestamp":1744618710715,"text":"Run: docker inspect --type container 240a168268e39df374572d62dce4ff61599028711968f99e66c14d248f5a1fe7"}
{"type":"stop","level":2,"timestamp":1744618710731,"text":"Run: docker inspect --type container 240a168268e39df374572d62dce4ff61599028711968f99e66c14d248f5a1fe7","startTimestamp":1744618710715}
{"type":"stop","level":2,"timestamp":1744618710731,"text":"Inspecting container","startTimestamp":1744618710715}
{"type":"start","level":2,"timestamp":1744618710732,"text":"Run in container: /bin/sh"}
{"type":"start","level":2,"timestamp":1744618710734,"text":"Run in container: uname -m"}
{"type":"stop","level":2,"timestamp":1744618710753,"text":"Run in container: /bin/sh","startTimestamp":1744618710732}
Shell server terminated (code: 126, signal: null)
no users found

{"type":"start","level":2,"timestamp":1744618710754,"text":"Run in container: (command -v getent >/dev/null 2>&1 && getent passwd 'foobar' || grep -E '^foobar|^[^:]*:[^:]*:foobar:' /etc/passwd || true)"}
{"type":"text","level":2,"timestamp":1744618710754,"text":"Stdin closed!"}
Error: An error occurred setting up the container.
at D6 (/usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:467:1253)
at Ix (/usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:467:997)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async H6 (/usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:484:3842)
at async BC (/usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:484:4957)
at async d7 (/usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:665:202)
at async f7 (/usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:664:14804)
at async /usr/local/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:484:1188
{"outcome":"error","message":"An error occurred setting up the container.","description":"An error occurred setting up the container.","containerId":"240a168268e39df374572d62dce4ff61599028711968f99e66c14d248f5a1fe7"}
```

devcontainer CLI version: `0.75.0`
OS: `Ubuntu 24.04.2 LTS`
Docker version: `Docker version 27.5.1, build 9f9e405`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.