Docker run 启动容器报错

今天在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=tcp
    
    Protocol tcp Port Exclusion Ranges
    
    Start Port    End Port
    ----------    --------
          1092        1191
          1192        1291
          1292        1391
          1392        1491
          1522        1621
          5357        5357
         12427       12526
         12628       12727
         12784       12883
         14343       14442
         14443       14542
         14543       14642
         14643       14742
         14743       14842
         14843       14942
         50000       50059
    

    1522正好在排除范围内,所以需要更换端口,修改成5522容器正常启动。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值