VSCode:无法使用远程开发扩展连接到 Docker 容器

VSCode: Cannot connect to Docker container using Remote Development extension

我正在尝试设置 VSCode,以便我可以处理位于 docker 容器内的项目。最近发布的扩展程序 Remote Development 似乎可以实现这一点。

我按照详细的 official instructions 创建 .devcontainer/devcontainer.json 并通过 运行 Remote-Containers: Reopen Folder in Container 设置远程,然而,即使使用 official/provided 容器和设置我得到错误:

Setting up container for folder: /home/ilijas/<path_to>/workspace
Error: (HTTP code 500) server error - linux spec user: unable to find user ilijas: no matching entries in passwd file 
        at /home/ilijas/.vscode-insiders/extensions/ms-vscode-remote.remote-containers-0.53.0/dist/extension.js:1:151013
        at /home/ilijas/.vscode-insiders/extensions/ms-vscode-remote.remote-containers-0.53.0/dist/extension.js:1:150976
        at m.buildPayload (/home/ilijas/.vscode-insiders/extensions/ms-vscode-remote.remote-containers-0.53.0/dist/extension.js:1:150986)
        at IncomingMessage.<anonymous> (/home/ilijas/.vscode-insiders/extensions/ms-vscode-remote.remote-containers-0.53.0/dist/extension.js:1:150486)
        at IncomingMessage.emit (events.js:187:15)
        at endReadableNT (_stream_readable.js:1090:12)
        at process._tickCallback (internal/process/next_tick.js:63:19)

在我的第一次尝试中,我尝试将本地工作区挂载到远程工作区,但是,由于我无法解决这个用户未找到的错误,我删除了 docker 设置中的所有参数尊敬的用户,只是为了让一个虚拟容器工作。我没有成功。我知道这是一个新的扩展,但我仍然希望有人能提供帮助。

基本上,删除所有以前的 docker 容器解决了这个问题。

引用GitHub issue:

The container has a label with the folder as the value, so it can be found again. When you close the window, the container is only stopped, not removed, for later use. (You could have some changes inside the container you want to keep. Also: Reusing an existing container is slightly faster.)