Docker 之 Windows Hyper-V 导致的端口占用问题
为什么会出现保留端口?
为什么排除一个系统的保留端口执行的是 "netsh interface ipv4 add excludeportrange ..." 而不是 "netsh interface ipv4 delete excludeportrange ..."?
"netsh interface ipv4 show excludedportrange protocol=tcp" 中的 "Administered port exclusions" 是啥意思?
以上问题可以参考:https://stackoverflow.com/questions/58216537/what-is-administered-port-exclusions-in-windows-10
netstat 查不到,启动程序却提示端口占用的解决办法:
# 查看动态端口范围
netsh int ipv4 show dynamicport tcp
# 查看例外端口范围
netsh interface ipv4 show excludedportrange protocol=tcp
# 如果提示被占用的端口在例外端口范围中,执行以下步骤
# 禁用Hyper-V [需要重启电脑]
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
# 添加例外端口 或者 设置动态端口范围
netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=1
netsh int ipv4 set dynamic tcp start=45000 num=10000
# 启动Hyper-V [需要重启电脑]
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
以下是常用命令:
# 禁用Hyper-V
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
# 启动Hyper-V
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
# 显示动态端口范围
netsh int ipv4 show dynamicport tcp
# 显示例外端口范围
netsh interface ipv4 show excludedportrange protocol=tcp
# 设置动态端口TCP范围
netsh int ipv4 set dynamicport tcp start=1024 num=13977
# 设置动态端口UDP范围
netsh int ipv4 set dynamicport udp start=1024 num=13977
# 添加例外端口
netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=1
列举几个端口如下:
22
80
8080
443
1099
3306
6379
5672
15672
25672
61616
61613
netsh int ipv4 add excludedportrange protocol=tcp startport=22 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=80 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=8000 numberofports=1000
netsh int ipv4 add excludedportrange protocol=tcp startport=443 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=3306 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=5672 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=15672 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=25672 numberofports=1
netsh int ipv4 add excludedportrange protocol=tcp startport=61613 numberofports=1
分类:
docker
posted on 2022-02-21 18:48 guardianbo 阅读(997) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!