Linux和Windows上的Docker-Compose之间是否有区别?

问题描述 投票:0回答:1

我遇到了Linux和Windows之间部署差异的问题。我有以下Docker-Compose文件:

version: '3'

services:

  elasticsearch:

    image: docker.elastic.co/elasticsearch/elasticsearch:6.3.0
    ports:
      - 9200:9200
    volumes:
      - elasticsearch_data:/usr/share/elasticsearch/data
    environment:
      discovery.type: single-node
      cluster.routing.allocation.disk.threshold_enabled: "false"
    networks:
      logmetric:

  kibana:
    image: docker.elastic.co/kibana/kibana:6.3.0
    ports:
      - 5601:5601
    networks:
      logmetric:
    depends_on:
      - elasticsearch

  influxdb:
    image: influxdb
    ports:
      - 8086:8086
    volumes:
      # Data persistency
      - influxdb_data:/var/lib/influxdb
    networks:
      logmetric:

  grafana:
    image: grafana/grafana
    ports:
      - 3000:3000
    volumes:
    # Data persistency
    - grafana_data:/var/lib/grafana
    networks:
      logmetric:

volumes:
  elasticsearch_data:
  influxdb_data:
  grafana_data:

networks:
  logmetric:
    driver: 'bridge'

当我在[[Windows]]上执行Docker-Compose -f compose_logging.yaml up时,一切正常旋转,并且所有服务都在工作。 但是,如果我将此yaml文件转移到我的linux计算机(CentOS 8)上并执行相同的命令,则Kibana无法连接到弹性搜索数据库。我收到错误:

kibana_1 | {“ type”:“ log”,“ @ timestamp”:“ 2020-04-03T21:41:42Z”,“ tags”:[“ warning”,“ elasticsearch”,“ admin”],“ pid”:1, “ message”:“无法恢复连接:http://elasticsearch:9200/”}kibana_1 | {“ type”:“ log”,“ @ timestamp”:“ 2020-04-03T21:41:42Z”,“ tags”:[“ warning”,“ elasticsearch”,“ admin”],“ pid”:1, “消息”:“没有任何生活联系”}

如果我在作为弹性搜索数据库的linux机器上'curl http://localhost:9200',则得到响应。因此,我相信启动起来并在等待连接。响应:

{ "name" : "CQ7jdN0", "cluster_name" : "docker-cluster", "cluster_uuid" : "swSAp0kUR7iQpqTpW3Iv_g", "version" : { "number" : "6.3.0", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "424e937", "build_date" : "2018-06-11T23:38:03.357887Z", "build_snapshot" : false, "lucene_version" : "7.3.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }

如果在docker网络(docker inspect andy_logmetric)上进行检查,则对于

LINUX

网络,我得到以下信息:[andy@Dev_Linux ~]$ docker inspect andy_logmetric [ { "Name": "andy_logmetric", "Id": "1d6544f05915e1673c5f541bcfe024fc3ad3d445cba43f0109a4bbd1e9faf9a0", "Created": "2020-04-03T15:59:24.036741117-04:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Attachable": true, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "091975207ec170c3c98223030add8f9b134f35b1aa05fd2016a31d985c73bc7f": { "Name": "andy_elasticsearch_1", "EndpointID": "b8263230459db25d873a79dff94e7d6b0a3cb8a2ed6bfff149559b54748e93cc", "MacAddress": "02:42:ac:12:00:04", "IPv4Address": "172.18.0.4/16", "IPv6Address": "" }, "10a22cc7ef65897417f58e0928598066ad899f25d43e2429c903282f5e74cef2": { "Name": "andy_kibana_1", "EndpointID": "1f8998efd1c61a40b9876ffd6502f0ec371ec926b5cd1e7851bd6dd31074c1c5", "MacAddress": "02:42:ac:12:00:05", "IPv4Address": "172.18.0.5/16", "IPv6Address": "" }, "542d6b764b084d99895f89c881aaf6fdf42edf63494edcd233dd35445706e3fc": { "Name": "andy_influxdb_1", "EndpointID": "4247f8fcb961e75fab6662133df9eb012a70707757db5ea6c37d7812c018f520", "MacAddress": "02:42:ac:12:00:03", "IPv4Address": "172.18.0.3/16", "IPv6Address": "" }, "e6fead6035cdb7b60e81114f124fa87084b7eb6b92c9b3800e66072dbcc82ba3": { "Name": "andy_grafana_1", "EndpointID": "9a0c892237fe891ef6e714bf8292857c9e2d68ac0f6abd7a99eba6daf6971f3c", "MacAddress": "02:42:ac:12:00:02", "IPv4Address": "172.18.0.2/16", "IPv6Address": "" } }, "Options": {}, "Labels": { "com.docker.compose.network": "logmetric", "com.docker.compose.project": "andy", "com.docker.compose.version": "1.25.4" } } ]
我在

WINDOWS

网络中得到以下信息:
PS C:\Users\Michael> docker inspect docker-composefiles_logmetric [ { "Name": "docker-composefiles_logmetric", "Id": "d1bebbe4e73097fb6dcb4ab15750e2689e2e57da83e880b065063dcde055e576", "Created": "2020-04-03T21:24:14.531822721Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Attachable": true, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "0820891e073e7e05cbcc7ab834cc599c640e6518bb36c848052b6a6c11b5c069": { "Name": "docker-composefiles_grafana_1", "EndpointID": "4e2c85709e89fd4b3bb609fc53eb4a4538b1fd93e51cfd73d8dc030d7707d6e3", "MacAddress": "02:42:ac:12:00:03", "IPv4Address": "172.18.0.3/16", "IPv6Address": "" }, "8ada45e8a940102fe3145dee290af2da06d46d8bd465411da48bddf18d22167a": { "Name": "docker-composefiles_elasticsearch_1", "EndpointID": "5cc9b924eb46a7bc1bc07d3985779a1e0bf9ac4012c12333d6cbb96e3f78af2d", "MacAddress": "02:42:ac:12:00:04", "IPv4Address": "172.18.0.4/16", "IPv6Address": "" }, "902bec9dc51e542589a3da1f13648a3434bc2d10b6c5755adfa545d813032c18": { "Name": "docker-composefiles_influxdb_1", "EndpointID": "a0e5e49121616590260b04932b6943601f06dc3200564f9155ce2f2281625cf9", "MacAddress": "02:42:ac:12:00:02", "IPv4Address": "172.18.0.2/16", "IPv6Address": "" }, "c054af26402fcbee5c9e727b8a3e8b009fd258734f060e1fc9dc19ade5f7f3fa": { "Name": "docker-composefiles_kibana_1", "EndpointID": "3f57dcaefde331cfa7bdc862f45a0dc95829cb89604b28347d8c452f0f60f396", "MacAddress": "02:42:ac:12:00:05", "IPv4Address": "172.18.0.5/16", "IPv6Address": "" } }, "Options": {}, "Labels": { "com.docker.compose.network": "logmetric", "com.docker.compose.project": "docker-composefiles", "com.docker.compose.version": "1.25.4" } } ]
转储这两个文件并运行比较只会产生明显的ID和项目名称不同。 

[如果我使用Chrome浏览器,则在Windows上一切正常。在linux kibana上,我进入一个禁用的登录屏幕,该屏幕显示您无法立即登录并查看日志。 (错误消息在上方)

网络外观相同,但是Kibana在Linux上无法访问弹性搜索数据库,但在Windows上可以访问。

Linux机器上的docker版本如下:

Docker version 19.03.8, build afacb8b [andy@Dev_Linux ~]$ docker-compose --version docker-compose version 1.25.4, build 8d51620a

Windows机器上的docker版本如下:

Docker version 19.03.8, build afacb8b PS C:\Users\Michael> docker-compose --version docker-compose version 1.25.4, build 8d51620a

我不知道还要寻找什么。是否对Linux环境中可能发生的事情有任何想法?

我遇到了Linux和Windows之间部署差异的问题。我有以下Docker-Compose文件:版本:'3'服务:elasticsearch:图片:docker.elastic.co / ...

docker elasticsearch docker-compose kibana docker-networking
1个回答
0
投票
检查此链接:
© www.soinside.com 2019 - 2024. All rights reserved.