今天在Windows下启动docker容器发现的三个错误:
-
Ports are not available: exposing port TCP 0.0.0.0:1521 -> 0.0.0.0:0: listen tcp 0.0.0.0:1521: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
端口不可用,端口被占用 -
Conflict. The container name “/aaa” is already in use by container “5ce25ceb6387357574ffb0c51bb96e6502a4a3cd16df49b7a3ad6795908482bf”. You have to remove (or rename) that container to be able to reuse that name.
容器名称已经存在,删除容器后再执行 -
Ports are not available: exposing port TCP 0.0.0.0:1522 -> 0.0.0.0:0: listen tcp 0.0.0.0:1522: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
端口禁止访问#执行查询端口后发现并没有端口被占用 netstat -ano | findstr :1522
# 查询动态端口范围 netsh int ipv4 show dynamicport tcp # 当我们开启Hyper-V后,系统默认会分配给一些保留端口供Hyper-V 使用: >netsh interface ipv4 show excludedportrange protocol=tcpProtocol tcp Port Exclusion RangesStart Port End Port ---------- --------1092 11911192 12911292 13911392 14911522 16215357 535712427 1252612628 1272712784 1288314343 1444214443 1454214543 1464214643 1474214743 1484214843 1494250000 50059
1522正好在排除范围内,所以需要更换端口,修改成5522容器正常启动。