There is no image named dgraph/dgraph:nightly. The image is dgraph/dgraph:master.
You can inspect the error message by running docker stack ps dgraph --no-trunc.
I changed nightly to master and removed the restart: on-failure line. docker swarm master node automatically handles the restart for you if a container goes down and it should not be part of the config file. The restart key is supported while using docker compose which is different from docker swarm. Here is the updated file.
version: "3"
networks:
dgraph:
services:
zero:
image: dgraph/dgraph:master
volumes:
- data-volume:/dgraph
ports:
- 5080:5080
- 6080:6080
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == AP-GRAPH-1
command: dgraph zero --my=zero:5080 --replicas 3
server_1:
image: dgraph/dgraph:master
hostname: "server_1"
volumes:
- data-volume:/dgraph
ports:
- 8080:8080
- 9080:9080
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == AP-GRAPH-1
command: dgraph server --my=server_1:7080 --lru_mb=17192 --zero=zero:5080
server_2:
image: dgraph/dgraph:master
hostname: "server_2"
volumes:
- data-volume:/dgraph
ports:
- 8081:8081
- 9081:9081
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == AP-GRAPH-2
command: dgraph server --my=server_2:7081 --lru_mb=17192 --zero=zero:5080 -o 1
server_3:
image: dgraph/dgraph:master
hostname: "server_3"
volumes:
- data-volume:/dgraph
ports:
- 8082:8082
- 9082:9082
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == AP-GRAPH-3
command: dgraph server --my=server_3:7082 --lru_mb=17192 --zero=zero:5080 -o 2
ratel:
image: dgraph/dgraph:master
hostname: "ratel"
ports:
- 8000:8000
networks:
- dgraph
command: dgraph-ratel
volumes:
data-volume:
You can see all the running services using docker service ls and you can see logs from a service using something like docker logs -f <service_name>.