1

I have three docker containers that I've created systemd scripts to run at startup. I've run systemctl enable xxxx for all three services, and i've tried systemctl reenable xxxx as well. I've created the scripts from the docker documenation. If I run the scripts with service xxx start, the script runs fine. Whenever I reboot, the docker service runs fine, but the three scripts remain loaded but inactive:

● guacd.service - Redis container
   Loaded: loaded (/etc/systemd/system/guacd.service; enabled; vendor preset: enabled)
   Active: inactive (dead)

The composition of my script /etc/systemd/system/guacd.service:

[Unit]
Description=Redis container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a guacd

ExecStop=/usr/bin/docker stop -t 2 guacd

[Install]
WantedBy=local.target
  • This isn't the right way to go about it to begin with. You should be setting Docker restart policies when you create the containers. – Michael Hampton Aug 2 '16 at 19:21
  • Which is what I have since done, however that does not explain why this documented feature does not work. – TheEmpireNeverEnded Aug 6 '16 at 3:26
-1

Is it WantedBy=local.target? Maybe WantedBy=local-fs.target

https://www.freedesktop.org/software/systemd/man/systemd.special.html#local-fs.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.