HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Docker swarm replica stays 0/1 and service stays in status new

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
swarmstaysnewdockerreplicastatusserviceand

Problem

I have a problem with my docker swarm. I created a new service with the following command:

docker-compose config | docker stack deploy -c - serviceNameX --with-registry-auth


The docker-compose file looks like that:

version: '3.1'
services:
  serviceNameX:
    image: ${DOCKER_REGISTRY}imageNameX:${VERSION}
    deploy:
      resources:
        limits:
          memory: 2gb
    env_file:
      - ../common.env
      - .env

networks:
  default:
    external:
      name: ${DOCKER_NETWORK}


fyi: docker-compose config is used because docker stack deploy can't expand environment variables. At least to my knowledge.

docker service ps serviceNameX

ID                  NAME                              IMAGE                                                         NODE                DESIRED STATE       CURRENT STATE       ERROR               PORTS
ify7vhl0l2m8        serviceNameX.1   nexus.local/imageNameX:1                                                                           Running             New 2 hours ago


docker service ls

afnjo97f6nuf        serviceNameX                      replicated          0/1                 nexus.local/imageNameX:1


All nodes are Ready and Active

There is no indication or information of an error. Usually docker service ps shows if an error occurs. Is there another useful log?

Solution

Try do pull your image manually first.

docker pull ${DOCKER_REGISTRY}imageNameX:${VERSION}


And then re-run your compose-file

It may be a bug using a private registry, or something simple as you don't have enough disk space to pull the image.

Code Snippets

docker pull ${DOCKER_REGISTRY}imageNameX:${VERSION}

Context

StackExchange DevOps Q#3690, answer score: 2

Revisions (0)

No revisions yet.