Skip to content

Restart the deployed containers when Docker restarts - #1839

Open
wittejm wants to merge 1 commit into
codeforpdx:masterfrom
wittejm:jw/container-restart-policy
Open

wittejm wants to merge 1 commit into
codeforpdx:masterfrom
wittejm:jw/container-restart-policy

Conversation

@wittejm

@wittejm wittejm commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Problem

make ssh_deploy started prod and staging with docker run --rm -d and no restart policy. When the Docker daemon restarts, it stops the containers, and --rm then deletes them. Nothing recreates them, so nginx has no upstream on ports 3031/3032 and returns 502.

On 2026-11-21 at 05:54 UTC, an apt upgrade on the droplet upgraded docker-ce (27 → 29) and containerd (1.7 → 2.4), which restarted the daemon. recordsponge.com returned 502 for about 40 hours, until the containers were started again by hand on 2026-11-22.

Change

--rm becomes --restart unless-stopped. The containers come back after a daemon restart or a reboot. The docker rm -f $(RS_ENV) before each run still replaces the container on every deploy.

The running prod and staging containers were started with this policy during recovery, so the droplet matches this change already.

🤖 Generated with Claude Code

ssh_deploy ran prod and staging with --rm and no restart policy, so a
Docker daemon restart deleted both containers and left nginx with no
upstream. A package upgrade on 2026-11-21 restarted Docker and took
recordsponge.com down with 502s for about 40 hours.

unless-stopped brings the containers back after a daemon restart or a
reboot. The docker rm -f before each run still replaces the old
container on deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant