Hello all,
I have the following services (main + sidekick):
Main unit: test@.service
[Unit]
After=etcd2.service
After=docker.service
Requires=etcd2.service
Requires=docker.service
Wants=test-sidekick@%i.service
[Service]
Restart=always
KillMode=none
ExecStartPre=/usr/bin/docker pull ubuntu
ExecStart=/usr/bin/docker run --name test-%i ubuntu /bin/bash -c "while true; do echo hello; sleep 5; done"
ExecStop=/usr/bin/docker stop test-%i
ExecStopPost=/usr/bin/docker rm test-%i
Sidekick unit: test-sidekick@.service
[Unit]
BindsTo=test@%i.service
After=test@%i.service
[Service]
ExecStart=/bin/bash -c "while true; do /usr/bin/etcdctl set /test %i; sleep 5; done"
ExecStop=/usr/bin/etcdctl rm --recursive /test
[X-Fleet]
MachineOf=test@%i.service
When I do a fleetctl destroy on a running instance, the main ExecStop is not being executed. The ExecStop of the sidekick unit is being executed. So in the end the etcd key is removed but the container is still up and running. If I change the ExecStop directive in the sidekick from /usr/bin/etcdctl rm to a /usr/bin/echo "STOP", everything works fine.