gpt4 book ai didi

docker-compose up 失败并显示 "Unable to find a node that satisfies the following conditions "

转载 作者:行者123 更新时间:2023-12-01 12:28:45 26 4
gpt4 key购买 nike

我的 docker-compose.yml 是:

version: '2'

services:

db:
build: ./postgres
ports:
- "5432:5432"
volumes:
- postgres-data:/data
env_file: .env
environment:
- "constraint:node=edge"
networks:
- back-tier

volumes:
postgres-data:
driver: local

networks:
back-tier:
driver: overlay

我在 googledocker swarm 中有两个节点。我用以下内容创建了它们:

## Swarm master
docker-machine --debug create --driver google --google-project my_project --swarm --swarm-discovery="consul://$cip:8500" --engine-opt="cluster-store=consul://$cip:8500" --engine-opt="cluster-advertise=eth0:2376" --swarm-master --engine-label node=director --google-disk-size 100 --google-machine-type n1-standard-2 director

## Nodo edge
docker-machine --debug create --driver google --google-project my_project --swarm --swarm-discovery="consul://$cip:8500" --engine-opt="cluster-store=consul://$cip:8500" --engine-opt="cluster-advertise=eth0:2376" --engine-label node=edge --google-scopes https://www.googleapis.com/auth/devstorage.read_write --google-disk-size 250 --google-machine-type n1-standard-4 node-0

我可以用 docker-machine ls 看到他们两个

consul            -           google      Running   tcp://X.X.X.X:2376                       v1.11.0   
director * (swarm) google Running tcp://X.X.X.X:2376 director (master) v1.11.0
node-0 - google Running tcp://X.X.X.X:2376 director v1.11.0

并且标签起作用了:

$ docker-machine ls --filter label=node=edge            
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
node-0 - google Running tcp://X.X.X.X:2376 v1.11.0

docker info 输出是

$ docker info
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 4
Server Version: swarm/1.2.0
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 2
director: 104.154.88.186:2376
└ Status: Healthy
└ Containers: 2
└ Reserved CPUs: 0 / 2
└ Reserved Memory: 0 B / 7.67 GiB
└ Labels: executiondriver=, kernelversion=4.2.0-18-generic, node=director, operatingsystem=Ubuntu 15.10, provider=google, storagedriver=aufs
└ Error: (none)
└ UpdatedAt: 2016-04-24T04:43:50Z
└ ServerVersion: 1.11.0
node-0: 104.197.85.59:2376
└ Status: Healthy
└ Containers: 1
└ Reserved CPUs: 0 / 4
└ Reserved Memory: 0 B / 15.42 GiB
└ Labels: executiondriver=, kernelversion=4.2.0-18-generic, node=edge, operatingsystem=Ubuntu 15.10, provider=google, storagedriver=aufs
└ Error: (none)
└ UpdatedAt: 2016-04-24T04:43:41Z
└ ServerVersion: 1.11.0
Plugins:
Volume:
Network:
Kernel Version: 4.2.0-18-generic
Operating System: linux
Architecture: amd64
CPUs: 6
Total Memory: 23.09 GiB
Name: director
Docker Root Dir:
Debug mode (client): false
Debug mode (server): false
WARNING: No kernel memory limit support

所以一切似乎都是对的,对吧?

但是当我尝试运行 docker-compose up -d

发生以下情况:

$ docker-compose up -d
Creating network "infraestructura_back-tier" with driver "overlay"
Creating volume "infraestructura_postgres-data" with local driver
Building db
Step 1 : FROM postgres:9.5
---> 0f3af79d8673
Step 2 : ADD create_tables.sql /docker-entrypoint-initdb.d
---> Using cache
---> 2f818eec1228
Successfully built 2f818eec1228
WARNING: Image for service db was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating infraestructura_db_1

ERROR: for db Unable to find a node that satisfies the following conditions
[port 5432 (Bridge mode)]

无论我做什么(尝试另一个图像、销毁并重新创建节点等),都会发生这种情况,除了删除 "constraint:node=edge"

我做错了什么?

顺便说一句,我的版本是:

$ docker version
Client:
Version: 1.11.0
API version: 1.23
Go version: go1.5.4
Git commit: 4dc5990
Built: Wed Apr 13 18:38:59 2016
OS/Arch: linux/amd64

Server:
Version: swarm/1.2.0
API version: 1.22
Go version: go1.5.4
Git commit: a6c1f14
Built: Wed Apr 13 05:58:31 UTC 2016
OS/Arch: linux/amd64


$ docker-machine -v
docker-machine version 0.6.0, build e27fb87


$ docker-compose -v
docker-compose version 1.7.0, build 0d7bf73


$ docker run --rm swarm -version
swarm version 1.2.0 (a6c1f14)

最佳答案

您可以尝试更改此行:

- "constraint:node=edge"

- "constraint:node==edge"

关于docker-compose up 失败并显示 "Unable to find a node that satisfies the following conditions ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36819398/

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