devcontainers / devcontainers/cli

`runArgs` in Dev Containers image isn't shared to `.devcontainers.json` workspace

オープン
#857 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
feature-request
主要言語
TypeScript
スター
3k
フォーク
457
平均マージ
13時間 17分
マージ済み PR(30日)
6

説明

Hi, I tried to use `runArgs` in Dev Containers custom image but this field isn't shared to `.devcontainers.json` workspace

- Logs :

1. when `runArgs` is set in Dev Containers custom image :

```sh
$ docker inspect f | grep PidMode
"PidMode": "", # pid isn't set to host
```

```sh
$ docker inspect f | grep NetworkMode
"NetworkMode": "bridge", # network isn't set to host
```

2. when `runArgs` is set in Dev Containers workspace that use the custom image :

```sh
$ docker inspect f | grep PidMode
"PidMode": "host", # pid is set to host

$ docker inspect f | grep NetworkMode
"NetworkMode": "host", # network is set to host
```

Steps to Reproduce :

1. when `runArgs` is set in Dev Containers custom image :

```json
// custom image configuration
{
"name": "Custom image",
"build": {
"dockerfile": "Dockerfile",
"args": {
"devcontainercli": "true"
}
},
"runArgs": [
"--network=host",
"--pid=host"
],
"capAdd": ["ALL"],
"securityOpt": ["seccomp=unconfined"],
"privileged": true,
[...]
}

// devcontainer.json workspace configuration
{
"name": "Dev Containers demo",
"image": "registry.example.com/example/custom-image:version",
[...]
}
```

2. when `runArgs` is set in Dev Containers workspace that use the custom image :

```json
// custom image configuration
{
"name": "Custom image",
"build": {
"dockerfile": "Dockerfile",
"args": {
"devcontainercli": "true"
}
},
"capAdd": ["ALL"],
"securityOpt": ["seccomp=unconfined"],
"privileged": true,
[...]
}

// devcontainer.json workspace configuration
{
"name": "Dev Containers demo",
"image": "registry.example.com/example/custom-image:version",
"runArgs": [
"--network=host",
"--pid=host"
],
[...]
}
```

Thank you !

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

この issue では custom-image と workspace devcontainer.json の構成が挙げられていますが、ソースファイルはありません。まず、workspace がイメージを使用する場合に runArgs がどのように読み取られ、結合されるかを追跡し、次に Docker inspect の PidMode と NetworkMode の結果を比較してください。custom-image から提供された runArgs が、それらを繰り返し指定しなくても利用側の workspace で反映されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, typescript
領域
devops, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。