VS 代码终端进程无法在附加的 运行 容器中作为调试启动

VS code terminal process failed to launch as debugging in attached running container

我正在尝试使用远程容器插件通过 VS 代码设置 Airflow 调试环境。到目前为止我做了什么:

  1. docker-compose up 图像 apache/airflow:2.2.4 with Docker 桌面社区 2.4 on macOS 10.13.6
  2. 使用 Remote - 容器插件附加到 运行ning airflow-scheduler 容器
  3. 编写一个launch.json文件
"version": "0.2.0",
"configurations": [
  {
    "name": "Airflow Test",
    "type": "python",
    "request": "launch",
    // $ which airflow
    "program": "/home/airflow/.local/bin/airflow",
    "console": "integratedTerminal",
    "args": [
      "dags",
      "test",
      "task_of_middleware",
      "2022-04-08"
    ],
    "justMyCode": true
  }
]

当我开始调试时,VS 代码弹出如下错误:

The terminal process failed to launch: Path to shell executable "/sbin/nologin" does not exist.

附加的运行ning容器显示错误:

[1382 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[1518 ms] Container server: Error: spawn /sbin/nologin ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1525 ms] Error: spawn /sbin/nologin ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1530 ms] Container server: (node:11888) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

我认为容器 运行 正常,因为我能够通过 Docker 桌面和 运行 气流测试命令连接到容器 shell。如有任何建议,我们将不胜感激。

不确定这是否是最佳做法,我找到了一种方法来缓解错误并使调试器 运行 正常。通过 select Remote-Containers 将配置放入附加的容器配置文件中:附加后从命令面板打开容器配置文件

// Container user VS Code should use when connecting
"remoteUser": "root"

Reference here.