3

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?

  • Other useful tools could be docker events, docker service inspect, and docker container inspect (on that ify7vhl0l2m8). I'd also do a watch docker service ps serviceNameX to see if tasks were re-spawing but indeed it's weird to see a single task "running" but a 0/1 in service ls. – Bret Fisher Mar 23 '18 at 3:56
  • The output was a little bit displaced, but actually the desired state is RUNNING and the actual state is NEW – anstue Mar 23 '18 at 14:55
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.