Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Ensuring Docker Compose Startup with Systemd

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

I’ve been having trouble getting some docker containers such as nginx to start automatically on bootup, even with the restart: always flag.

To compensate, I wrote a small systemd script and enabled it on startup.


Description=Docker Compose Application Service
Requires=network.target docker.service
After=network.target docker.service

ExecStart=/usr/bin/docker-compose up -d --force-recreate
ExecStop=/usr/bin/docker-compose down


To enable on startup

sudo systemctl enable docker-compose

To start now

sudo systemctl start docker-compose
Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :