docker service replicas remain 0/1

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.


This also can happen if you specify a volume in your compose file that is bound to a local directory that does not exist.

If you look at the log (on some Linux systems, this is journalctl -xe), you'll see which volume can't be bound.