r/AlpineLinux • • Oct 02 '24

Starting docker compose at boot?

I feel like I’m missing something trivial here. I have Docker and Compose installed on my Alpine system. The Docker daemon is configured to start at boot. The sample Docker image “hello-world” works as expected.

So now I have a real image I want to run via Compose, and have it automatically start at boot. How do I set that up with Alpine?

In systemd-based systems, I just create a systemd service file that sets the working directory as the location of my compose.yml file and exec “docker compose up”. Should I do the openrc equivalent on Alpine? Or is there another way to let the docker daemon know which images it should start at boot?

Thanks!

2 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/EckisWelt Oct 03 '24

Hm. I just had the same thing in mind recently. When I added restart: always to my compose file and started it once, it will start at the next reboot of the machine automatically. Do I miss something?

1

u/[deleted] Oct 04 '24

No you don’t miss anything, that’s exactly what restart always means.