win10上安装nacos容器报端口被占用
错误如下图
排查过程
1、检查8848端口是否被占用
1 | netstat -ano | findstr 9091 |
结论:没有
2、经过google搜索Hyper-V会保留部分TCP端口,而windows上想要运行docker desktop,必须开启Hyper-V服务
1 | netsh interface ipv4 show excludedportrange protocol=tcp |
命令查询结果,8848在排除范围内
3、在standalone-derby.yml文件里面修改nacos、grafana、Prometheus的端口,修改后的配置文件如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | version: "2" services: nacos: image: nacos /nacos-server :${NACOS_VERSION} container_name: nacos-standalone environment: - PREFER_HOST_MODE= hostname - MODE=standalone - NACOS_AUTH_IDENTITY_KEY=serverIdentity - NACOS_AUTH_IDENTITY_VALUE=security - NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789 volumes: - . /standalone-logs/ : /home/nacos/logs ports: - "8948:8848" - "10848:9848" prometheus: container_name: prometheus image: prom /prometheus :latest volumes: - . /prometheus/prometheus-standalone .yaml: /etc/prometheus/prometheus .yml ports: - "9390:9090" depends_on: - nacos restart: on-failure grafana: container_name: grafana image: grafana /grafana :latest ports: - 3000:3000 restart: on-failure |
4、启动nacos、grafana、Prometheus
1 | docker-compose -f example /standalone-derby .yaml up |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构