【问题标题】:How to run docker-compose against docker swarm (without docker-machine)如何针对 docker swarm 运行 docker-compose(没有 docker-machine)
【发布时间】:2016-04-15 08:56:39
【问题描述】:

我已经设法在the official tutorial 之后手动设置了一个 docker swarm(例如:不使用 docker-machine)

我能够使用 docker 引擎在 swarm 上成功运行容器:

docker -H :4000 run redis

我想使用 docker-compose 在 swarm 上运行容器,但我似乎无法做到这一点。

我必须解决的第一件事是如何让 compose 在端口 :4000 上通话。我通过指定:export DOCKER_HOST=":4000" 来实现这一点。

但是,现在,当我运行 docker-compose 时,出现以下错误:

$docker-compose up
Creating network "root_default" with the default driver
ERROR: Error response from daemon: failed to parse pool request for address space "GlobalDefault" pool "" subpool "": cannot find address space GlobalDefault (most likely the backing datastore is not configured)

感觉这个问题与 TLS 或网络有关,但我对如何修复它甚至如何进一步调查它感到很困惑。

我正在使用 Docker 引擎:1.10,Compose 1.6。群:最新

如果有用,这里是我的 docker 信息:

$docker -H :4000 info
Containers: 7
 Running: 5
 Paused: 0
 Stopped: 2
Images: 7
Server Version: swarm/1.2.0
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 2
 node02: 10.129.5.211:2375
  └ Status: Healthy
  └ Containers: 3
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 2.053 GiB
  └ Labels: executiondriver=, kernelversion=3.13.0-79-generic, operatingsystem=Ubuntu 14.04.4 LTS, storagedriver=aufs
  └ Error: (none)
  └ UpdatedAt: 2016-04-15T08:28:20Z
  └ ServerVersion: 1.11.0
 node03: 10.129.6.21:2375
  └ Status: Healthy
  └ Containers: 4
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 2.053 GiB
  └ Labels: executiondriver=, kernelversion=3.13.0-79-generic, operatingsystem=Ubuntu 14.04.4 LTS, storagedriver=aufs
  └ Error: (none)
  └ UpdatedAt: 2016-04-15T08:28:43Z
  └ ServerVersion: 1.11.0
Plugins: 
 Volume: 
 Network: 
Kernel Version: 3.13.0-79-generic
Operating System: linux
Architecture: amd64
CPUs: 4
Total Memory: 4.105 GiB
Name: b156985db557
Docker Root Dir: 
Debug mode (client): false
Debug mode (server): false
WARNING: No kernel memory limit support

【问题讨论】:

    标签: docker docker-compose docker-swarm


    【解决方案1】:

    我在生产中使用 Docker 1.10、Docker Swarm、Docker Compose。

    我过去也遇到过同样的问题。我通过以下步骤解决了它:

    第一步:export DOCKER_HOST=tcp://localhost:4000

    第 2 步:通过命令 docker info(不带 -H)验证 Docker Swarm。如果不行,请确保 Swarm Manager 正在运行您的主机。

    第 3 步:如果第 2 步正常。在 Docker Compose 上运行您的应用程序 docker-compose up

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,在这里找到了答案:https://groups.google.com/a/weave.works/forum/m/#!topic/weave-users/Mf6fv9OEd-E

      解决了什么问题:

      要使其与 docker-compose 2 一起使用,您应该添加:

      network_mode: "bridge" 
      

      到所有服务定义。

      【讨论】:

        【解决方案3】:

        要消除上述错误,您需要像这样在每个节点上运行 docker deamon

        docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise 192.168.56.103:4000 consul://192.168.56.101:8500

        【讨论】:

        • 嗨舒亚。我想我已经这样做了? (至少在主节点上)——你能解释一下该命令解决上述问题的具体内容吗?
        • @toast38coza 该错误表明 Docker 引擎守护程序未配置为针对发现服务工作。上面的建议将解决它
        • 我认为这不是问题.. 我为 swarm master 运行的确切命令是:docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise <own_ip>:4000 consul://<consul_ip:8500
        猜你喜欢
        • 1970-01-01
        • 2017-12-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多