Running docker-compose services with systemd

So a couple of days ago I've started looking into developing a systemd service blueprint to use for managing services defined with docker-compose.

My situation:

  • one docker-compose.yml file that defines a base service with a volume and some environment variables (host volume location defined via an .env file)
  • several services extending the base service (the only ones to be run actually)


  • still debating: one file vs several files (but all extending from one base yml), might be slightly better since the base will never be used by itself
  • stopping or starting a given service shouldn't stop or remove all the other services (several files might make this easier to manage)
  • good to have: cleaning network, volumes and images (remove orphans) of the service currently managed


As the needed file ( isn't where I was expecting it to be, after a search I found it at /lib/systemd/network/

Running docker-compose services with systemd
Share this