andyceo / bash_scripts

My bash scripts collection
20 stars 6 forks source link

docker-service-exec.sh Error: No suitable container found, exit. #3

Closed qyvlik closed 4 years ago

qyvlik commented 4 years ago

docker-service-exec.sh Error: No suitable container found, exit.

docker version:

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:22:05 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea838
  Built:            Wed Nov 13 07:28:45 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

I run docker-service-exec.sh in a vm which create by docker-machine.

docker-service-exec.sh redis-failover_master /bin/sh

Error as follow:

2020-01-09T03:22:44UTC [redis-failover_master] No suitable container found, exit.

docker service ls output as follow:

ID                  NAME                      MODE                REPLICAS            IMAGE               PORTS
wquhm14bqjje        redis-failover_master     replicated          0/1                 redis:5-alpine      
q3ym4vfk6u0a        redis-failover_sentinel   replicated          0/1                 redis:5-alpine      
qs645y4m2kiu        redis-failover_slave      replicated          2/2                 redis:5-alpine  

docker ps -a output as follow(nothing):

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

source code: docker-service-exec.sh

qyvlik commented 4 years ago

Ok, the docker service startup failure in Leader node.