docker服务副本保持0/1 [英] docker service replicas remain 0/1

查看:594
本文介绍了docker服务副本保持0/1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Mac上试用1.12的docker swarm。我启动了3个VirtualBox VM,创建了3个都很好的群集集群。

  docker @ redis1:〜$ Docker节点ls 
ID主机名状态可用性管理器状态
2h1m8equ5w5beetbq3go56ebl redis3准备就绪
8xubu8g7pzjvo34qdtqxeqjlj redis2准备就绪可到达
cb0lyekxmp00j09

但是,当我创建服务时,没有看到错误,但是副本始终显示0/1:

  docker @ redis1:〜$ docker service create --replicas 1 --name hello ubuntu:latest / bin / bash 
76kvrcvnz6kdhsmzmug6jgnjv
docker @ redis1:〜$ docker service ls
ID名称副本图像命令
76kvrcvnz6kd hello 0/1 ubuntu:latest / bin / bash
docker @ redis1:〜$ docker ps
容器ID图像命令和创建的状态端口

可能是什么他有问题吗?我在哪里寻找日志?
谢谢!

解决方案

问题是您的任务(调用bin / bash)由于没有执行任何操作而迅速退出



如果查看服务任务,您会看到一个已启动,然后在几秒钟内关闭。由于要求您始终运行1个任务,因此另一个启动,关闭等操作。

  docker服务ps你好

如果使用 ubuntu:latest top 例如,任务将保持运行状态。


I am trying out docker swarm with 1.12 on my Mac. I started 3 VirtualBox VMs, created a swarm cluster of 3 all fine.

docker@redis1:~$ docker node ls 
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
2h1m8equ5w5beetbq3go56ebl    redis3  Ready Active 
8xubu8g7pzjvo34qdtqxeqjlj    redis2  Ready Active Reachable 
cbi0lyekxmp0o09j5hx48u7vm *  redis1  Ready Active Leader

However, when I create a service, I see no errors yet replicas always displays 0/1:

docker@redis1:~$ docker service create --replicas 1 --name hello ubuntu:latest /bin/bash
76kvrcvnz6kdhsmzmug6jgnjv
docker@redis1:~$ docker service ls
ID            NAME   REPLICAS  IMAGE          COMMAND
76kvrcvnz6kd  hello  0/1       ubuntu:latest  /bin/bash
docker@redis1:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

What could be the problem? Where do I look for logs? Thanks!

解决方案

The problem is that your tasks (calling bin/bash) exits quickly since it's not doing anything.

If you look at the tasks for your service, you'll see that one is started and then shutdown within seconds. Another one is then started, shutdown and so on, since you're requested that 1 task be running at all times.

docker service ps hello

If you use ubuntu:latest top for instance, the task will stay up running.

这篇关于docker服务副本保持0/1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆