gpt4 book ai didi

bash - 无法在docker中访问Windows Linux容器的Elasticsearch

转载 作者:行者123 更新时间:2023-12-02 19:35:39 25 4
gpt4 key购买 nike

我主要在Windows上使用Bash作为子系统,为Windows(版本17.06.0-ce-win19(12801))安装了docker,并将其设置为Linux容器。

我正在尝试通过以下命令启动它

sudo docker run -d -p 9200 elasticsearch:2.3.5

如果我尝试通过bash上的curl访问它,或者在浏览器中找不到它。我尝试了以下操作:
  • 本地主机:9200
  • 127.0.0.1:9200
  • (容器ip地址):9200 [通过docker network inspect网桥获得]
  • (我的本地IP地址):9200 [ifconfig]


    • docker logs e727aa95a49d
      • [2017-07-30 01:07:50,114][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: your kernel is buggy and you should upgrade
      • [2017-07-30 01:07:50,296][INFO ][node ] [Alysande Stuart] version[2.3.5], pid[1], build[90f439f/2016-07-27T10:36:52Z]
      • [2017-07-30 01:07:50,296][INFO ][node ] [Alysande Stuart] initializing ...
      • [2017-07-30 01:07:51,046][INFO ][plugins ] [Alysande Stuart] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
      • [2017-07-30 01:07:51,066][INFO ][env ] [Alysande Stuart] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda1)]], net usable_space [54.3gb], net total_space [58.8gb], spins? [possibly], type s [ext4]
      • [2017-07-30 01:07:51,066][INFO ][env ] [Alysande Stuart] heap size [1007.3mb], compressed ordinary object pointers [true]
      • [2017-07-30 01:07:52,684][INFO ][node ] [Alysande Stuart] initialized
      • [2017-07-30 01:07:52,685][INFO ][node ] [Alysande Stuart] starting ...
      • [2017-07-30 01:07:52,852][INFO ][transport ] [Alysande Stuart] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
      • [2017-07-30 01:07:52,857][INFO ][discovery ] [Alysande Stuart] elasticsearch/TIf_RDG_SpqbfJ_rJmfizA
      • [2017-07-30 01:07:55,920][INFO ][cluster.service ] [Alysande Stuart] new_master {Alysande Stuart}{TIf_RDG_SpqbfJ_rJmfizA}{172.17.0.2}{172.17.0.2:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
      • [2017-07-30 01:07:55,972][INFO ][http ] [Alysande Stuart] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
      • [2017-07-30 01:07:55,972][INFO ][node ] [Alysande Stuart] started
      • [2017-07-30 01:07:55,999][INFO ][gateway ] [Alysande Stuart] recovered [0] indices into cluster_state

    最佳答案

    -p 9200告诉Docker在Windows上找到任何可用的端口(让我们说32768)并将其映射到9200容器端口。

    你需要这个:

    sudo docker run -d -p 9200:9200 elasticsearch:2.3.5

    借助 -p 9200:9200,Docker将始终使用将在您的本地主机中可用的 9200: localhost:9200

    关于bash - 无法在docker中访问Windows Linux容器的Elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45395649/

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