windows环境下的设置docker远程访问(开放2375端口)

本文介绍了如何设置Docker以暴露2375端口,不使用TLS,通过修改配置文件和重启Docker。接着,通过Powershell命令添加防火墙规则允许TCP流量进入2375端口。最后,进行了测试验证,包括使用命令行和浏览器访问Docker版本信息。
摘要由CSDN通过智能技术生成

一、设置docker

1、设置暴露2375端口不使用安全传输层协议

Expose daemon on tcp://localhost:2375 without TLS

 2、设置配置文件暴露2375端口

 "hosts": [
    "tcp://0.0.0.0:2375"
  ]

3、重启Docker 

 

二、设置防火墙

使用管理员打开powershell,执行下边命令

netsh advfirewall firewall add rule name="docker_daemon" dir=in action=allow protocol=TCP localport=2375
New-NetFirewallRule -DisplayName 'Docker SSL Inbound' -Profile @('Domain', 'Public', 'Private') -Direction Inbound -Action Allow -Protocol TCP -LocalPort 2376

三、测试

 docker -H 127.0.0.1:2375 info

 浏览器访问

http://localhost:2375/version
{
"Platform": {
"Name": "Docker Desktop 4.17.0 (99724)"
},
"Components": [
{
"Name": "Engine",
"Version": "20.10.23",
"Details": {
"ApiVersion": "1.41",
"Arch": "amd64",
"BuildTime": "2023-01-19T17:32:04.000000000+00:00",
"Experimental": "false",
"GitCommit": "6051f14",
"GoVersion": "go1.18.10",
"KernelVersion": "5.15.90.1-microsoft-standard-WSL2",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "1.6.18",
"Details": {
"GitCommit": "2456e983eb9e37e47538f59ea18f2043c9a73640"
}
},
{
"Name": "runc",
"Version": "1.1.4",
"Details": {
"GitCommit": "v1.1.4-0-g5fd4c4d"
}
},
{
"Name": "docker-init",
"Version": "0.19.0",
"Details": {
"GitCommit": "de40ad0"
}
}
],
"Version": "20.10.23",
"ApiVersion": "1.41",
"MinAPIVersion": "1.12",
"GitCommit": "6051f14",
"GoVersion": "go1.18.10",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "5.15.90.1-microsoft-standard-WSL2",
"BuildTime": "2023-01-19T17:32:04.000000000+00:00"
}

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值