Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

DEPLOY - NÃO SOBE TODOS OS SERVICOS

Boa Noite, após o deploy esta dando erro em alguns serviços que não sobem e quando fui ver estão sendo rejeitados.

-> Status dos serviços

root@vm3:/# docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                                          PORTS
se37zcd5ibvd        vote_db             replicated          0/1                 postgres:9.4
t30l6ja0ef9s        vote_redis          replicated          0/1                 redis:alpine
xxpgg4ubqqer        vote_result         replicated          1/1                 dockersamples/examplevotingapp_result:before   *:5001->80/tcp
ijgtwttwk9oc        vote_visualizer     replicated          1/1                 dockersamples/visualizer:stable                *:8080->8080/tcp
aby7q54u3yca        vote_vote           replicated          1/2                 dockersamples/examplevotingapp_vote:before     *:5000->80/tcp
mg5c9vo8blen        vote_worker         replicated          0/1                 dockersamples/examplevotingapp_worker:latest

--> TRAVADOS NÃO SOBEM


--> TRAVADOS NÃO SOBEM
root@vm3:/# docker service ps se
ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE             ERROR                       PORTS
3hr1lffyo8ok        vote_db.1           postgres:9.4        vm1                 Ready               Preparing 3 seconds ago
06e9lgm8xlp6         \_ vote_db.1       postgres:9.4        vm3                 Shutdown            Failed 4 seconds ago      "task: non-zero exit (1)"
xt6s922hktok         \_ vote_db.1       postgres:9.4        vm3                 Shutdown            Failed 14 seconds ago     "task: non-zero exit (1)"
4ssta4xeliuy         \_ vote_db.1       postgres:9.4        vm2                 Shutdown            Failed 23 seconds ago     "task: non-zero exit (1)"
1w1x1b6udvq1         \_ vote_db.1       postgres:9.4        vm2                 Shutdown            Failed 31 seconds ago     "task: non-zero exit (1)"


root@vm3:/# docker service ps t3
ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE              ERROR                           PORTS
qhsopi7epiq5        vote_redis.1        redis:alpine        vm2                 Running             Preparing 18 minutes ago
0tmgyd64lcme         \_ vote_redis.1    redis:alpine        vm2                 Shutdown            Rejected 18 minutes ago    "No such image: redis:alpine"
u3cidiapncat         \_ vote_redis.1    redis:alpine        vm2                 Shutdown            Rejected 18 minutes ago    "No such image: redis:alpine"

root@vm3:/# docker service ps mg
ID                  NAME                IMAGE                                          NODE                DESIRED STATE       CURRENT STATE             ERROR                       PORTS
kh2mcvozmzgs        vote_worker.1       dockersamples/examplevotingapp_worker:latest   vm5                 Running             Preparing 4 minutes ago
kl51j6zs50zd         \_ vote_worker.1   dockersamples/examplevotingapp_worker:latest   vm4                 Shutdown            Failed 4 minutes ago      "task: non-zero exit (1)"
3mulun59vb9g         \_ vote_worker.1   dockersamples/examplevotingapp_worker:latest   vm4                 Shutdown            Failed 4 minutes ago      "task: non-zero exit (1)"
pxo8i1ejxwfs         \_ vote_worker.1   dockersamples/examplevotingapp_worker:latest   vm4                 Shutdown            Failed 5 minutes ago      "task: non-zero exit (1)"
67de2cexiy1h         \_ vote_worker.1   dockersamples/examplevotingapp_worker:latest   vm4                 Shutdown            Failed 5 minutes ago      "task: non-zero exit (1)"
4 respostas

Olá Jose Carlos, tudo bem? É estranho esse erro, fiz o mesmo procedimento aqui e deu tudo certo, você poderia disponibilizar o conteúdo do arquivo docker-compose.yml pra gente pode analisar e verificar qual o possível erro!

Deletei as vm duas vezes e refiz o processo e realmente com este arquivo abaixo não funciono. Porém outro que fiz esta funcionando o Banco Cassandra e o portainer

version: "3"
services:

  redis:
    image: redis:alpine
    networks:
      - frontend

  db:
    image: postgres:9.4
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend

  vote:
    image: dockersamples/examplevotingapp_vote:before
    ports:
      - 5000:80
    networks:
      - frontend
    depends_on:
      - redis

  result:
    image: dockersamples/examplevotingapp_result:before
    ports:
      - 5001:80
    networks:
      - backend
    depends_on:
      - db

  worker:
    image: dockersamples/examplevotingapp_worker
    networks:
      - frontend
      - backend
    depends_on:
      - db
      - redis

  visualizer:
    image: dockersamples/visualizer:stable
    ports:
      - 8080:8080
    stop_grace_period: 1m30s
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"

networks:
  frontend:
  backend:

volumes:
  db-data:

Codigo abaixo funcionando nas VM normalmente

version: "3"
services:

  redis:
    image: redis:alpine
    networks:
      - frontend

  db:
    image: postgres:9.4
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend

  vote:
    image: dockersamples/examplevotingapp_vote:before
    ports:
      - 5000:80
    networks:
      - frontend
    depends_on:
      - redis

  result:
    image: dockersamples/examplevotingapp_result:before
    ports:
      - 5001:80
    networks:
      - backend
    depends_on:
      - db

  worker:
    image: dockersamples/examplevotingapp_worker
    networks:
      - frontend
      - backend
    depends_on:
      - db
      - redis

  visualizer:
    image: dockersamples/visualizer:stable
    ports:
      - 8080:8080
    stop_grace_period: 1m30s
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"

networks:
  frontend:
  backend:

volumes:
  db-data:
solução!

José Carlos, você poderia executar usando o seguinte conteúdo no arquivo:

version: "3"
services:

  redis:
    image: redis:alpine
    networks:
      - frontend
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure

  db:
    image: postgres:9.4
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend
    deploy:
      placement:
        constraints: [node.role == manager]

  vote:
    image: dockersamples/examplevotingapp_vote:before
    ports:
      - 5000:80
    networks:
      - frontend
    depends_on:
      - redis
    deploy:
      replicas: 2
      restart_policy:
        condition: on-failure

  result:
    image: dockersamples/examplevotingapp_result:before
    ports:
      - 5001:80
    networks:
      - backend
    depends_on:
      - db
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure

  worker:
    image: dockersamples/examplevotingapp_worker
    networks:
      - frontend
      - backend
    depends_on:
      - db
      - redis
    deploy:
      mode: replicated
      replicas: 1
      labels: [APP=VOTING]
      restart_policy:
        condition: on-failure
      placement:
        constraints: [node.role == worker]

  visualizer:
    image: dockersamples/visualizer:stable
    ports:
      - 8080:8080
    stop_grace_period: 1m30s
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    deploy:
      placement:
        constraints: [node.role == manager]

networks:
  frontend:
  backend:

volumes:
  db-data:

Fala pra gente o resultado!

Aaaa perfeito eu que confundi de arquivos aqui este no caso e o ultimo arquivo o qual implanto a parte do deploy.

Obrigado