一、设置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"
}

 

 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐