Skip to content

fix: enable automatic container restart on failure or system reboot#112

Merged
guyb1 merged 1 commit intoonecli:mainfrom
evenisse:feat/docker-restart-policy
Mar 26, 2026
Merged

fix: enable automatic container restart on failure or system reboot#112
guyb1 merged 1 commit intoonecli:mainfrom
evenisse:feat/docker-restart-policy

Conversation

@evenisse
Copy link
Copy Markdown
Contributor

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Feature - Infrastructure/DevOps improvement

What is the current behavior?

Docker containers do not automatically restart if the Docker daemon restarts or the host machine reboots. This results in service downtime until manual intervention is required to bring containers back online.

What is the new behavior?

Added the restart: unless-stopped policy to both the postgres and app services in the docker-compose configuration.

Benefits:

  • Containers automatically recover from crashes or unexpected exits
  • Containers automatically restart after Docker daemon or system reboots
  • Services are resilient and maintain high availability
  • Exception: containers explicitly stopped via docker stop or docker-compose down remain stopped, allowing for controlled maintenance

Additional context

This change aligns with production best practices for containerized services and follows Docker documentation recommendations for service resilience.

Changes made:

  • Modified docker/docker-compose.yml to add restart: unless-stopped to postgres service
  • Modified docker/docker-compose.yml to add restart: unless-stopped to app service

**Current behavior:**
- Docker containers do not restart if the daemon restarts or the machine reboots
- Service downtime until manual intervention

**New behavior:**
- Added 'restart: unless-stopped' policy to postgres and app services
- Containers automatically recover from crashes
- Containers restart after Docker daemon or system reboots
- Exception: containers stopped explicitly via 'docker stop' or 'docker-compose down' stay stopped

This aligns with production best practices for service resilience and high availability.
@guyb1 guyb1 force-pushed the feat/docker-restart-policy branch from 4ac7ebf to 18bcbb6 Compare March 26, 2026 07:49
@guyb1 guyb1 changed the title feat: enable automatic container restart on failure or system reboot fix: enable automatic container restart on failure or system reboot Mar 26, 2026
@guyb1
Copy link
Copy Markdown
Contributor

guyb1 commented Mar 26, 2026

Thanks for this! Merging now. @evenisse
We'd love to hear how you're using OneCLI, feel free to join us on Discord if you want to chat:
https://discord.gg/PSztzsQB3g

@guyb1 guyb1 merged commit c933ad9 into onecli:main Mar 26, 2026
1 check passed
@guyb1 guyb1 mentioned this pull request Mar 26, 2026
hisgarden pushed a commit to hisgarden/onecli that referenced this pull request Mar 27, 2026
…necli#112)

**Current behavior:**
- Docker containers do not restart if the daemon restarts or the machine reboots
- Service downtime until manual intervention

**New behavior:**
- Added 'restart: unless-stopped' policy to postgres and app services
- Containers automatically recover from crashes
- Containers restart after Docker daemon or system reboots
- Exception: containers stopped explicitly via 'docker stop' or 'docker-compose down' stay stopped

This aligns with production best practices for service resilience and high availability.
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.

2 participants