devcontainers / devcontainers/cli

devcontainer always started with `"Init": true` no matter the settings

Đang mở
#726 5 bình luận 0 reaction 1 người được giao Được @chrmarti nhận Xem trên GitHub
info-needed
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ả

I'm trying to set `init` to `false` for a devcontainer where I need to control PID 1.

However, no matter how I set init to false, the resulting dev container has init always set to true:
```
╰─ docker inspect life_life_1 | grep Init
"Init": true
```

This also shows in the logs:
```
[2024-01-19T17:33:17.093Z] Docker Compose override file for creating container:
version: "3.8"

services:
'life':
entrypoint: ["/bin/sh", "-c", "echo Container started\n
trap \"exit 0\" 15\n
\n
exec \"$$@\"\n
while sleep 1 & wait $$!; do :; done", "-"]
command: ["/sbin/init"]
init: true
privileged: true
cap_add:
- SYS_PTRACE
- SYS_ADMIN
security_opt:
- seccomp=unconfined
labels:
- 'devcontainer.local_folder=/home/workspaces/ife'
- 'devcontainer.config_file=/home/workspaces/life/.devcontainer/devcontainer.json'
volumes:
- vscode:/vscode
volumes:

vscode:
external: true
```

Here is what I've tried:

1. Setting it in `devcontainer.json`.
This seems to be the most obvious one. Although the [default should actually be `false`](https://containers.dev/implementors/json_reference). This doesn't work, the resulting container will still have `"Init": true`.
```json
{
"name": "life",
"init": false,
...
}
```
2. Setting it in `docker-compose.yml`.
Of course I also set it in my docker-compose.yml, but that just got overridden by devcontainer cli.
3. Setting it in `Dockerfile`.
I've also set it via
```
LABEL devcontainer.metadata='[{ \
"init": false \
}]'
```
as described in the docs, but still in the resulting container it's true.

I've set all these at once to false and still the resulting container has it set to true.

The line of code in question is this one:
https://github.com/devcontainers/cli/blob/47354089b2eacf89b713dde767ca5536c2d6fa60/src/spec-node/imageMetadata.ts#L172
But where could it possibly get a `true` from?

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.