omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Docker DB installer containers don't survive reboot (docker.service disabled, only docker.socket enabled)

Open jlupox opened this issue 3 months ago • 3 comments

System details

Omarchy 4.0.1-1 (Quattro), Docker 29.7.2, PostgreSQL installed via Install > Development > Docker DB, Reproduced on two separate Omarchy Quattro 4.0.1 systems

What's wrong?

Containers installed through Install > Development > Docker DB do not come back up after a reboot, even though they're configured with --restart unless-stopped.

After boot:

docker.service disabled / inactive
docker.socket enabled / listening
postgres18 stopped

A TCP connection to a published container port (e.g. a Rails app connecting to 127.0.0.1:5432) does not activate the daemon and fails with Connection refused. Running sudo docker ps -a does activate it (because it hits /run/docker.sock directly), and once the daemon is up, Postgres starts on its own thanks to unless-stopped — no other action needed.

Root cause

This is intentional in Quattro: only docker.socket is enabled at boot, docker.service is explicitly disabled:

  • install/config/enable-services.sh:7 → enables docker.socket only
  • bin/omarchy-upgrade-to-quattro:1350 → systemctl disable docker.service
  • bin/omarchy-upgrade-to-quattro:1356 → enables docker.socket

Socket activation only wakes the daemon when something touches /run/docker.sock directly (e.g. docker ps). A TCP connection to a container's published port goes through docker-proxy, a child process of dockerd — which doesn't exist while the daemon is down, so there's no listener at all. --restart unless-stopped is a daemon-side policy applied when the daemon starts, so it never gets a chance to fire if the daemon never starts.

This affects every database installable through that menu, not just Postgres — they're all published on loopback ports with the same restart policy (bin/omarchy-install-docker-dbs:18-23).

Steps to reproduce

  1. Install PostgreSQL via Install > Development > Docker DB > PostgreSQL
  2. Verify the container is running
  3. Reboot
  4. Start a local app configured to use 127.0.0.1:5432
  5. Connection is refused
  6. Run sudo docker ps -a
  7. Access the app again — it now works

Expected behavior

A DB installed through Install > Development > Docker DB should be reachable after a reboot without manual intervention, or Quattro should document the expected mechanism to bring these containers up.

Suggested fix

Enable docker.service alongside docker.socket when installing anything from the Docker DB menu:

sudo systemctl enable --now docker.service

This shouldn't cost boot time — the repo already ships a drop-in that keeps docker.service off the boot critical path:

etc/systemd/system/docker.service.d/no-block-boot.conf
[Unit]
DefaultDependencies=no

So the socket stays as-is and just doesn't need to be "poked" anymore for containers with published ports to survive a reboot.

Happy to submit a PR with this fix if that's the direction you'd want — just let me know.

Related

Originally reported and diagnosed in Discussion #8415: https://github.com/basecamp/omarchy/discussions/8415

jlupox avatar Aug 27 '26 06:08 jlupox

Proposed approach: keep socket activation as the default. When Install > Development > Docker DB actually creates a container, enable and start docker.service so --restart unless-stopped can bring the database back after reboot. A migration does the same for existing mysql8 / postgres18 / mariadb11 / redis / mongodb / mssql containers.

Will not re-enable docker.service for machines that never installed a Docker DB.

Elshayib avatar Aug 27 '26 20:08 Elshayib

Check https://github.com/basecamp/omarchy/pull/8098

twiking avatar Aug 28 '26 06:08 twiking

Confirmed in source on current quattro (c352b62); not reproduced with a live reboot. Fresh installs enable only docker.socket (install/config/enable-services.sh:6), the Quattro upgrade disables docker.service (bin/omarchy-upgrade-to-quattro:1438), and bin/omarchy-install-docker-dbs:18-23 creates the containers with --restart unless-stopped without enabling the service. The no-block-boot.conf drop-in only sets DefaultDependencies=no and does not start anything at boot. So nothing starts dockerd until something touches /run/docker.sock, a TCP connection to the published port has no listener, and the restart policy never gets a chance to run. This affects all six databases in that menu, as you describe.

Nothing on quattro fixes this yet. #8704 is the open fix: it enables docker.service when Install > Docker DB creates or finds one of its containers, plus a migration for existing ones, and it already links this issue. That pull request is reviewed as its own item; this one is waiting on the maintainer's decision there.

Checked by Claude Opus 5.5, with Codex Medium as a second opinion. It reached the same mechanism and found no boot path that starts dockerd. It agreed with a conclusion already written down, so treat it as agreement rather than an independent finding.

omarchybot avatar Oct 09 '26 03:10 omarchybot