Featured image of post VSCode 配置

VSCode 配置

VSCode Docker 插件远程访问

远程服务器中开启 Docker 远程访问

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

# 设定所使用的TCP端口
port=2233

# 修改Docker配置文件
file=/lib/systemd/system/docker.service
cp ${file} ${file}.bac
sed -i "s/ExecStart=.*/& -H tcp\:\/\/0\.0\.0\.0\:${port}/g" ${file}

# 重启Docker
systemctl daemon-reload && service docker restart


# 本地测试
curl http://localhost:${port}/version

本地 VSCode 配置

使用快捷键 Ctrl + , 打开 VSCode 设置

使用搜索字符串@ext:ms-azuretools.vscode-docker host

修改 Docker:Hosttcp://IP:2233,其中 IP 为服务器 IP 地址