docker 踩坑记录:WSL DOCKER DESKTOP Ports are not available: listen tcp...


docker Desktop启动容器报错:Ports are not available: listen tcp...,从WSL用docker start能启动,但映射docker端口之后并不能访问,是因为windows10 为hyper-V保留了部分端口,解决办法:
来自 https://github.com/docker/for-win/issues/3171

  1. Disable hyper-v (which will required a couple of restarts)
    dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
  2. When you finish all the required restarts, reserve the port you want so hyper-v doesn't reserve it back
    netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1
  3. Re-Enable hyper-V (which will require a couple of restart)
    dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

其他相关命令(参考微软文档:The default dynamic port range for TCP/IP has changed)
查看保留的端口:
netsh interface ipv4 show excludedportrange protocol=tcp
查看当前占用端口的进程:
netstat –ano|findstr “port”
查看当前动态端口范围:
netsh int ipv[46] show dynamicport tcp
设置动态端口范围:
netsh int ipv[46] set dynamic tcp start=49152 num=16384


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM