background
Xx is the Intranet IP of the servers in the laboratory, which cannot be directly accessed at home. After the configuration of the elder brother, another server 47.110.xx.yy can be used for springboard connection. The operation of connecting to the server in the laboratory by using the command line is as follows:
If you still want to connect to the Docker Container in the server, you need to sudo exec once and enter the password again, which is very bald. Therefore, you want to use VScode Remote SSH to achieve a two-level jump to directly connect to the Docker in the server
Preliminary knowledge
VSCode Remote SSH to connect the local machine to the Remote server (wherein docker) operation will be skipped, you can refer to VSCode connecting to the docker container in the Remote server
Or refer to other blogs that use the vscode plug-in to connect to remote servers
- Install SSH on Docker Ubuntu and connect to the ssh_justtofaith-CSDN blog
- VSCode+Docker: Create the most comfortable deep learning environment – Zhihu
- VSCode uses the Remote SSH plug-in to remotely connect to the server and Remote development
Here describes how to connect to the remote server through the intermediate hop machine
Start the configuration
- Click SSH Plug-in – click gear in the upper right corner
- You can directly select the first default SSH config file
- The configuration is based on the situation of the jumper and the remote server
In my case
- The IP address of the jumper is 47.110.xx.yy, and the local SSH-key has been authorized to it (you can log in without password). For details about how to log in to the Server without password, see LOGGING in to the Server without password
- Xx server IP is 192.168.1.xx, docker container open port is 6789
ProxyCommand SSH -w %h:%p
, and make sure that this name is consistent with the springboard name defined above
Host invix_springboard HostName 47.110.xx.yy Port 6000 User root IdentityFile ~/. SSH /id_rsa! [38D6999E-E733-479D-88AA-9E14E1048603.png](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/68e94f8586414fe9bbbc5e9896e Bc1c1 ~tplv-k3u1fbpfcp-watermark. Image) Host Server HostName 192.168.1.xx Port 6789 User root ProxyCommand SSH -w %h:%p invix_springboardCopy the code
Connection to use
You can then directly click the remote server’s Connect button – enter the password to complete the connection to 🎉
Resources
Vscode connects to the remote server _thewaysofar-csDN blog via a jumper (fortress)