基本上,我尝试在一个m1 mac上设置一个带有elasticsearch和kibana的环境。我已经将de env变量DOCKER_DEFAULT_PLATFORM
设置为linux/amd64
。在运行容器时一切看起来都很好,但是当我尝试将kibana连接到elastic时,它们就看不到彼此了。这是我当前的docker-composer
文件:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3-amd64
environment:
- discovery.type=single-node
- node.name=elasticsearch1
- cluster.name=docker-cluster
- cluster.initial_master_nodes=elasticsearch1
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms128M -Xmx128M"
ports:
- 9200:9200
networks:
- my-network
kibana:
image: docker.elastic.co/kibana/kibana:8.3.3-amd64
environment:
SERVER_NAME: localhost
ELASTICSEARCH_URL: http://localhost:9200/
ports:
- 5601:5601
depends_on:
- elasticsearch
networks:
- my-network
在此之前,我使用的是links
而不是networks
,也没有运气。从我的终端或浏览器,我可以看到弹性和kibana运行在各自的端口。我在这里没有想法,感谢任何帮助!
EDIT docker ps输出
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
265023669cfd docker.elastic.co/kibana/kibana:8.3.3-amd64 "/bin/tini -- /usr/l…" 14 minutes ago Up 14 minutes 0.0.0.0:5601->5601/tcp folha3_kibana_1
48ee37663dda docker.elastic.co/elasticsearch/elasticsearch:8.3.3-amd64 "/bin/tini -- /usr/l…" 14 minutes ago Up 14 minutes 0.0.0.0:9200->9200/tcp, 9300/tcp folha3_elasticsearch_1
6b1f6dd9473f redis "docker-entrypoint.s…" 14 minutes ago Up 14 minutes 0.0.0.0:6379->6379/tcp folha3_redis_1
2a3ade65634a mysql:5.7 "docker-entrypoint.s…" 14 minutes ago Up 14 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp folha3_mysql_1
1条答案
按热度按时间kupeojn61#
ELASTICSEARCH_URL: http://localhost:9200/
应为http://my-network:9200/
,localhost
无法访问ElasticSearch容器