I'm monkeying with consul trying to set up a small CoreOS cluster. If I save the following file to /etc/systemd/system/consul.service, enable the service, and reboot the VM, all 3 vms in the cluster will happily start up properly and join together
[Unit]
Description=consul
After=etcd2.service
After=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill consul
ExecStartPre=-/usr/bin/docker rm consul
ExecStart=/usr/bin/docker run -d --name consul --network host consul agent -server -bootstrap-expect=3 -data-dir /tmp/consul -bind BIND_IPADDR --node NODE_NAME -retry-join IPADDR1 -retry-join IPADDR2
# ExecStop=/usr/bin/docker container exec consul consul leave
# ExecStopPost=/usr/bin/docker container stop consul
# ExecStopPost=/usr/bin/docker container rm consul
[Install]
WantedBy=multi-user.target
If, however, I remove the comments from the ExecStop commands, the startup will fail, in the sense of no consul containers are running after the vms reboot. systemctl --failed doesn't report any services as having failed though.
What am I doing wrong? Am I misunderstanding ExecStop? Consul?