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容器正常启动。

相关推荐
江湖有缘1 小时前
零基础入门:使用 Docker 快速部署 Organizr 个人主页
java·服务器·docker
广州中轴线2 小时前
OpenStack on Kubernetes 生产部署实战(十三)
容器·kubernetes·openstack
礼拜天没时间.3 小时前
深入Docker架构——C/S模式解析
linux·docker·容器·架构·centos
猫头虎3 小时前
如何使用Docker部署OpenClaw汉化中文版?
运维·人工智能·docker·容器·langchain·开源·aigc
会周易的程序员3 小时前
openplc runtimev4 Docker 部署
运维·c++·物联网·docker·容器·软件工程·iot
小Pawn爷4 小时前
1.Docker基础
运维·docker·容器
chinesegf4 小时前
清理docker残留镜像images
运维·docker·容器
小Pawn爷4 小时前
2.Docker的存储
运维·docker·容器
广州中轴线4 小时前
OpenStack on Kubernetes 生产部署实战(十七)
容器·kubernetes·openstack
礼拜天没时间.5 小时前
自定义镜像制作——从Dockerfile到镜像
linux·docker·容器·centos·bash