0

I am trying to deploy my working docker-compose set up to a docker-swarm, everything seems ok, except that the only service that got replicate and generate a running container is the redis one, the 3 others got stuck and never generate any running container, they don't even download their respective images. I can't find any debug feature, all the logs are empty, I'm completely helpless. Let me show you the current state of my installation.

docker node ls print =>

ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS
oapl4et92vjp6mv67h2vw8boq     boot2docker         Ready               Active
x2fal9iwj6aqt1vgobyp1smv1 *   manager1            Ready               Active              Leader
lmtuojednaiqmfmm2izl7npf0     worker1             Ready               Active

The docker compose =>

version: '3'
services:
  mongo:
    image: mongo
    container_name: mongo
    restart: always
    volumes:
      - /data/db:/data/db
    deploy:
      placement:
        constraints: [node.role == manager]
    ports:
      - "27017:27017"

  redis:
    image: redis
    container_name: redis
    restart: always

  bnbkeeper:
    image: registry.example.tld/keepers:0.10
    container_name: bnbkeeper
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    depends_on:
      - mongo
      - redis
    ports:
      - "8080:8080"
    links:
      - mongo
      - redis
    environment:
      - REDIS_HOST=redis
      - MONGO_HOST=mongo

  bnbkeeper-ws:
    image: registry.example.tld/keepers:0.10
    container_name: bnbkeeper-ws
    restart: unless-stopped
    depends_on:
      - mongo
      - redis
    ports:
      - "3800:3800"
    links:
      - mongo
      - redis
    environment:
      - REDIS_HOST=redis
    command: npm run start:subscription

The current state of my services

ID                  NAME                 MODE                REPLICAS            IMAGE                                     PORTS
tbwfswsxx23f        stack_bnbkeeper      replicated          0/5                 registry.example.tld/keepers:0.10
khrqtx28qoia        stack_bnbkeeper-ws   replicated          0/1                 registry.example.tld/keepers:0.10
lipa8nvncpxb        stack_mongo          replicated          0/1                 mongo:latest
xtz2411htcg7        stack_redis          replicated          1/1                 redis:latest

My redis successful service (docker service ps stack_redis)

ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE            ERROR               PORTS
cqv0njcgsw6f        stack_redis.1       redis:latest        worker1             Running             Running 25 minutes ago

my mongo unsuccessful service (docker service ps stack_mongo)

ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE        ERROR               PORTS
yipokxxiftqq        stack_mongo.1       mongo:latest                            Running             New 25 minutes ago

I'm completely new to docker swarm, and probably made a silly mistake here, but I couldn't find much documentation on how to setup such a simple stack.

Duduche
  • 445
  • 4
  • 18
  • The containers running on the workers won't be listed here, as you are in the docker environment of the manager node. – Vamsi Nov 24 '17 at 10:34
  • Yes, but does that explain why all my services except redis aren’t replicated? – Duduche Nov 24 '17 at 10:37

2 Answers2

1

To monitor, try this:

journalctl -f -n10

Then run the docker stack deploy command in a separate session and see what it shows

0

try removing port publish and add --endpoint-mode dnsrr to your service.

Keaz
  • 955
  • 1
  • 11
  • 21