docker run --rm \ --name=vscode \ --cap-add=IPC_LOCK \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ -p 3000:3000 \ -p 3001:3001 \ --shm-size="1gb" \ -v /ssd1/wy/workspace3:/ssd1/wy/workspace3 \ -v /ssd1/wy/workspace3/vscode-config:/config \ -e HTTP_PROXY=http://192.168.3.61:7890 \ -e HTTPS_PROXY=http://192.168.3.61:7890 \ -e ALL_PROXY=socks5://192.168.3.61:7890 \ registry.cn-hangzhou.aliyuncs.com/wybioinfo/vscode:1.122.1
ssh -N \ -J wy@10.10.10.10 \ -R 0.0.0.0:7890:192.168.1.243:7890 \ wy@192.168.3.61
含义是:
192.168.3.61:7890 ↓ 转发到 192.168.1.243:7890
但是否能监听在 192.168.3.61:7890(对外可访问),不仅取决于 -R 0.0.0.0:7890,还取决于 SSH 服务端(192.168.3.61)的配置。
192.168.3.61:7890
-R 0.0.0.0:7890
在 192.168.3.61 上:
sudo grep GatewayPorts /etc/ssh/sshd_config
如果看到:
GatewayPorts no
或者没有配置,
那么实际上会变成:
127.0.0.1:7890
即:
ss -lntp | grep 7890
显示:
外部机器无法访问。
编辑:
sudo vim /etc/ssh/sshd_config
添加:
GatewayPorts clientspecified
或者:
GatewayPorts yes
然后:
sudo systemctl restart sshd
重新建立隧道。
Github开源生信云平台 DEMO