3 ms·
I'd make systemd unit files around the docker-compose deployments. Upload everything with something like Ansible. If you want to go perfect go for NixOS instead
by tinco 6y ago
I'd make systemd unit files around the docker-compose deployments. Upload everything with something like Ansible. If you want to go perfect go for NixOS instead, but that might be controversial.
- StavrosK 6y agoDoesn't Compose take care of that with "restart: always"? Though that probably doesn't work on reboot...
- 0_gravitas 6y agoIt does!
- easton 6y ago"restart: always" and "restart: unless-stopped" both work fine after reboot on my system. (Although Docker recommends managing it using systemd or upstart if you want more granular control). https://docs.docker.com/config/containers/start-containers-automatically/ https://docs.docker.com/config/containers/start-containers-a...
- StavrosK 6y agoThis is for Docker, right? Not Compose? Though I guess Compose would just set the flag in Docker, in which case it'd do the same thing. I don't want more granularity than "unless stopped", basically, so this is ideal, thanks!
- mldbk 6y agoDocker-compose is just a wrapper by itself. It just make volumes, port forwarding, etc based what you you will describe in your docker-compose file. So if you have proper Docker installation, containers will restart on reboot.
- 3np 6y agoI think the main question is: do you need orchestration? Ie scheduling workloads dynamically to different machines. If yes, then ks/Nomad/Swarm. If no and you want minimal overhead then the above is the answer. I’d also suggest Podman as a Docker alternative, especially for these scenarios. Images and Dockerfiles (and many commands) are 1-to-1 compatible but there are some nice things especially with this scenario. I wouldn’t say NixOS is controversial, at all, but it’s a very steep learning curve.