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.

    端口禁止访问

    bash 复制代码
    #执行查询端口后发现并没有端口被占用
    netstat -ano | findstr :1522
    bash 复制代码
    # 查询动态端口范围
    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容器正常启动。

相关推荐
Alsn8620 小时前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
2601_961875241 天前
决战申论100题2026|最新|范文
linux·容器·centos·debian·ssh·fabric·vagrant
java_cj1 天前
深入kube-apiserver认证机制:从Bearer Token到mTLS的完整认证链解析
linux·运维·服务器·云原生·容器·kubernetes
程序员老赵1 天前
服务器没有桌面?Docker 跑个 Chrome,浏览器就能远程用
docker·容器·devops
杨浦老苏1 天前
轻量级Docker仪表板Servedash
运维·docker·监控·群晖·仪表板
正经教主1 天前
【docker基础】 第八周:容器监控与应用更新策略
运维·docker·容器
kiros_wang1 天前
Docker 使用完整指南
运维·docker·容器
正经教主1 天前
【docker基础】第九周:Docker安全与镜像优化
运维·docker·容器
CodeStats1 天前
【虚拟机】 从 CPU 指令到虚拟机隔离:虚拟机就是一个“模拟了完整硬件的普通进程”
java·docker
ai产品老杨1 天前
突破安防碎片化:基于 Docker 与边缘计算的 AI 视频智能化中台,如何通过 GB28181/RTSP 统一接入与全套源码交付实现二次开发自由?
人工智能·docker·边缘计算