docker: Error response from daemon: Ports are not available

在使用 docker 部署 zookeeper 时,出现错误提示。

docker run -d -p 2181:2181 --name=zookeeper --privileged zookeeper

错误提示:
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:2181: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

2181 端口不让用

使用命令
netsh interface ipv4 show excludedportrange protocol=tcp
可以查看哪些端口不让用

docker: Error response from daemon: Ports are not available

最简单的处理方式:不让用,就不用咯。

// 修改暴露端口为 3181
docker run -d -p 3181:2181 --name=zookeeper --privileged zookeeper

参考文章:

Ports are not available: listen tcp 0.0.0.0:3000: bind: An attempt was made to access a socket in a way forbidden by its access permissions. | by Jihoon Park | Medium

至于为什么不让用,可以参看:
Unable to bind ports: Docker-for-Windows & Hyper-V excluding but not using important port ranges · Issue #3171 · docker/for-win

原文链接:https://www.cnblogs.com/jasongrass/p/13726009.html

相关推荐