gpt4 book ai didi

docker-compose up 错误,地址无效

转载 作者:行者123 更新时间:2023-12-01 19:43:19 24 4
gpt4 key购买 nike

我想使用elastic的docker-elk,然后我克隆了elastic的github代码。我想为每个容器使用特定的IP,所以我为每个容器定义一个特定的IP,当我运行docker-compose up时,我遇到错误

ERROR: for elasticsearch  Cannot start service elasticsearch: Invalid address 172.18.1.3: It does not belong to any of this network's subnets
ERROR: Encountered errors while bringing up the project.

它没有显示任何网络的子网,但我定义了子网,并且 docker-compose.yml 像这样

version: '2'

services:

elasticsearch:
build: elasticsearch/
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
elk:
ipv4_address: 172.18.1.3

logstash:
build: logstash/
ports:
- "5000:5000"
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
elk:
ipv4_address: 172.18.1.4
depends_on:
- elasticsearch

kibana:
build: kibana/
ports:
- "5601:5601"
networks:
elk:
ipv4_address: 172.18.1.5
depends_on:
- elasticsearch

networks:

elk:
driver: bridge
ipam:
config:
- subnet: 172.18.1.0/24

docker版本

Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:20:36 2017
OS/Arch: linux/amd64

Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:21:56 2017
OS/Arch: linux/amd64
Experimental: false

最佳答案

我刚刚遇到了这个问题,我的问题似乎是 docker 如何缓存网络和容器的问题。我必须docker network rm之前创建的网络。我还必须 docker ps -adocker rm 之前创建的容器,因为它们被缓存以使用您将要删除的网络。在我删除所有剩余的工件后,它可以正确启动。

关于docker-compose up 错误,地址无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45648821/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com