老师,deploy时example_worker 连接失败

来源:7-8 作业解答之部署投票应用

Ganjr

2020-08-13

[vagrant@swarm-manager 07_02_example-voting-app]$ docker stack deploy example --compose-file=docker-compose.yml
Creating network example_default
Creating network example_frontend
Creating network example_backend
Creating service example_worker
Creating service example_visualizer
Creating service example_redis
Creating service example_db
Creating service example_vote
Creating service example_result
[vagrant@swarm-manager 07_02_example-voting-app]$ docker stack ps example 
ID                  NAME                   IMAGE                                          NODE                DESIRED STATE       CURRENT STATE                ERROR                       PORTS
cvlwqclt7r62        example_result.1       dockersamples/examplevotingapp_result:before   swarm-worker2       Running             Running 13 seconds ago                                   
rs13ciw6yh0q        example_vote.1         dockersamples/examplevotingapp_vote:before     swarm-worker2       Running             Running 53 seconds ago                                   
zyazs9a0k35g        example_db.1           postgres:9.4                                   swarm-manager       Running             Running about a minute ago                               
atnbccfb8jc3        example_redis.1        redis:alpine                                   swarm-worker2       Running             Running about a minute ago                               
0jxps8qsrsy4        example_worker.1       dockersamples/examplevotingapp_worker:latest   swarm-manager       Shutdown            Failed about a minute ago    "task: non-zero exit (1)"   
burpg9733ls6        example_visualizer.1   dockersamples/visualizer:stable                swarm-manager       Running             Running about a minute ago                               
vpmmnbr6j60y        example_worker.1       dockersamples/examplevotingapp_worker:latest   swarm-manager       Shutdown            Failed about a minute ago    "task: non-zero exit (1)"   
z45e088nqjdy         \_ example_worker.1   dockersamples/examplevotingapp_worker:latest   swarm-manager       Shutdown            Failed 2 minutes ago         "task: non-zero exit (1)"   
iio4xlehny1r         \_ example_worker.1   dockersamples/examplevotingapp_worker:latest   swarm-manager       Shutdown            Failed 2 minutes ago         "task: non-zero exit (1)"   
u90k1czycnxg        example_vote.2         dockersamples/examplevotingapp_vote:before     swarm-worker1       Running             Running 53 seconds ago                                   
n2us8yfi6q95        example_redis.2        redis:alpine                                   swarm-worker1       Running             Running about a minute ago   
example_worker.1.z45e088nqjdy@swarm-manager    | System.AggregateException: One or more errors occurred. (No such device or address) ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Net.Dns.<>c.<GetHostAddressesAsync>b__14_1(IAsyncResult asyncResult)
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
example_worker.1.z45e088nqjdy@swarm-manager    |    --- End of inner exception stack trace ---
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
example_worker.1.z45e088nqjdy@swarm-manager    |    at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout)
example_worker.1.z45e088nqjdy@swarm-manager    |    at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout)
example_worker.1.z45e088nqjdy@swarm-manager    |    at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)
example_worker.1.z45e088nqjdy@swarm-manager    |    at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout)
example_worker.1.z45e088nqjdy@swarm-manager    |    at Npgsql.NpgsqlConnection.OpenInternal()
example_worker.1.z45e088nqjdy@swarm-manager    |    at Worker.Program.OpenDbConnection(String connectionString) in /code/src/Worker/Program.cs:line 74
example_worker.1.z45e088nqjdy@swarm-manager    |    at Worker.Program.Main(String[] args) in /code/src/Worker/Program.cs:line 19
example_worker.1.z45e088nqjdy@swarm-manager    | ---> (Inner Exception #0) System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Net.Dns.<>c.<GetHostAddressesAsync>b__14_1(IAsyncResult asyncResult)
example_worker.1.z45e088nqjdy@swarm-manager    |    at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)<---
example_worker.1.z45e088nqjdy@swarm-manager    | 
写回答

1回答

麦兜搞IT

2020-08-13

您好,docker-compose文件贴出来我看看,我这边也试试

0
3
Ganjr
回复
麦兜搞IT
嗯,我是把之前小节的目录直接考过来准备自己建镜像的,后来把这些 dockerfile 所在的目录都删除,worker 就连上了,但我的 swarm 是没有用原来目录里的镜像,用的课程里 Docker Hub 的镜像
2020-08-16
共3条回复

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程