Consul with Swarm

Hi Guys

I need help in figuring out what I’m missing. I’m trying to run consul inside swarm.

The command I’ve used - docker stack deploy -c docker-compose.yml nodeconsul

Here is my docker-compose.yml
version: ‘3’

services:

consul-server:
image: consul:1.4.0
environment:
CONSUL_LOCAL_CONFIG: ‘{ “connect”: { “enabled”: true }}’
command: [“agent”, “-ui”, “-client=0.0.0.0”, “-bind=0.0.0.0”, “-data-dir=/consul/data”, “-server”, “-bootstrap-expect=1”, “-config-dir=/etc/consul.d” ]
volumes:
- ./consul-server/consul.d:/etc/consul.d
ports:
- 8500:8500

registrator:
image: gliderlabs/registrator:latest
command: “-ip {MYHOST} consul://{MYHOST}:8500”
depends_on:
- consul-server
volumes:
- /var/run/docker.sock:/tmp/docker.sock

I’ve attached some screenshot. Many Thkx

This one works for me,

consul:
image: consul:latest
networks:
- my_net
command: “agent -log-level trace -server -ui -bootstrap-expect=1 -retry-join consul -disable-host-node-id -raft-protocol=1 -client=0.0.0.0 -recursor=8.8.8.8”
ports:
- “8500:8500”
- “8600:8600/udp”
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- “CONSUL_LOCAL_CONFIG={“disable_update_check”: true,“skip_leave_on_interrupt”:true,“leave_on_terminate”:true}”
deploy:
replicas: 1
restart_policy:
condition: on-failure
healthcheck:
test: [“CMD”, “/some_health_check_script.sh”]
interval: 20s
timeout: 5s
retries: 3
start_period: 60s