Skip to content

Instantly share code, notes, and snippets.

@miclgael
Forked from kizzx2/docker-compose.yml
Created May 3, 2023 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miclgael/b5413a2ceab65b6076019886e9f444c6 to your computer and use it in GitHub Desktop.
Save miclgael/b5413a2ceab65b6076019886e9f444c6 to your computer and use it in GitHub Desktop.
Restart a docker container periodically with docker-compose
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker:cli
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart app_app_1; done"]
restart: unless-stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment