vscode 进入docker容器 因为我是在windows是安装的vscode而docker安装在ubuntu上因此要先使用vscode使用ssh打开远程再在远程vscode上进入docker容器1.通过ssh打开远程linux参考链接vscode 使用ssh打开远程项目2.安装插件使用vscode进入ubuntu后再安装插件而不是直接在windows上安装插件Name: Dev ContainersId: ms-vscode-remote.remote-containersDescription: Open any folder or repository inside a Docker container and take advantage of Visual Studio Code’s full feature set.Version: 0.466.0Publisher: MicrosoftVS Marketplace Link: https://marketplace.visualstudio.com/items?itemNamems-vscode-remote.remote-containers3.使用Dev Containers插件进入docker容器1.确保docker容器正常运行例如本次我运行了一个nginx容器dockerpull ubuntu:22.04dockerrun-d--nameubuntu-test--userroot ubuntu:22.04tail-f/dev/nulltail -f /dev/null让容器保持运行不退出。tail -f /dev/null 的意思是持续监听空文件命令不会结束因此容器会一直活着。2.打开打开Remote Explorer找到REMOTES下的Dev Containers找到ubuntu-test容器点击右侧的-符号即可进入容器等待在容器中安装插件安装完成后即可进入容器