gpt4 book ai didi

docker - 无法将docker-compose与覆盖网络配合使用

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

我很困惑这里发生的事情,但是我将其范围缩小到一个非常小的测试用例。这是我的docker-compose文件:

version: "3.7"
networks:
cl_net_overlay:
driver: overlay
services:
redis:
image: "redis:alpine"
networks:
- cl_net_overlay

cl_net_overlay网络不存在。当我用以下命令运行时:
docker-compose up

它停了一段时间,然后说:
WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use `docker stack deploy`.

Creating network "tmp_cl_net_overlay" with driver "overlay"
Recreating tmp_redis_1 ... error

ERROR: for tmp_redis_1 Cannot start service redis: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded

ERROR: for redis Cannot start service redis: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded
ERROR: Encountered errors while bringing up the project.

在以前的笔记本电脑上,该文件对我来说运行良好。我的docker和docker-compose应该是最新的,因为这是一台全新的笔记本电脑。我缺少一些难题吗?
05:01:11::mlissner@gabbro::/tmp 
↪ docker --version
Docker version 19.03.1, build 74b1e89
05:01:57::mlissner@gabbro::/tmp
↪ docker-compose --version
docker-compose version 1.24.1, build 4667896b

有什么想法吗?我一直在努力让它整天工作,但我感觉有点迷失了方向。

小跟进。消息说:

make sure your network options are correct and check manager logs



我不知道如何检查经理日志。那可能是有用的第一步?

根据评论进行另一次跟进。如果我尝试部署它,我将没有日志,也无法启动:
05:44:32::mlissner@gabbro::~/Programming/courtlistener/docker/courtlistener 
↪ docker stack deploy --compose-file /tmp/docker-compose.yml test2
Creating network test2_cl_net_overlay2
Creating service test2_redis

05:44:50::mlissner@gabbro::~/Programming/courtlistener/docker/courtlistener
↪ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
5y7o01o5mifn test2_redis replicated 0/1 redis:alpine

05:44:57::mlissner@gabbro::~/Programming/courtlistener/docker/courtlistener
↪ docker service ps 5y
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
0kbph0ie8qth test2_redis.1 redis:alpine gabbro Ready Rejected 4 seconds ago "mkdir /var/lib/docker: read-o…"
inr81c3r4un7 \_ test2_redis.1 redis:alpine gabbro Shutdown Rejected 9 seconds ago "mkdir /var/lib/docker: read-o…"
tl1h6dp90ur2 \_ test2_redis.1 redis:alpine gabbro Shutdown Rejected 14 seconds ago "mkdir /var/lib/docker: read-o…"
jacv2yvkspix \_ test2_redis.1 redis:alpine gabbro Shutdown Rejected 19 seconds ago "mkdir /var/lib/docker: read-o…"
7cm6e8snf517 \_ test2_redis.1 redis:alpine gabbro Shutdown Rejected 19 seconds ago "mkdir /var/lib/docker: read-o…"

另一个想法:以root身份运行。同样的问题。

最佳答案

您是否拥有正确的插件(请参阅docker info命令的更多信息)?

Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay

它适用于:
$ docker swarm init
$ docker-compose up
WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use `docker stack deploy`.

Creating network "stackoverflow-57701373_cl_net_overlay" with driver "overlay"
Pulling redis (redis:alpine)...
alpine: Pulling from library/redis
9d48c3bd43c5: Pull complete
(...)
redis_1 | 1:M 29 Aug 2019 01:27:31.969 * Ready to accept connection

什么时候:
$ docker --version
Docker version 19.03.1-ce, build 74b1e89e8a

info:
$ docker info
Client:
Debug Mode: false

Server:
(...)
Server Version: 19.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
NodeID: ff5mogx0ph4pgmwm2zrbhmjb4
Is Manager: true
ClusterID: vloixv7g75jflw5i1k81neul1
Managers: 1
Nodes: 1
(...)

关于docker - 无法将docker-compose与覆盖网络配合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57701373/

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