-
-
Save kizzx2/782b500a81ce46b889903b1f80353f21 to your computer and use it in GitHub Desktop.
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 |
Thanks. This is exactly what I was looking for.
Thanks. Best solution I've found.
Excellent. Thank you for the work.
What is the exact container name that we should specify? The restarter is telling me no such container
What is the exact container name that we should specify? The restarter is telling me no such container
Looks like you can specify the container name using the container_name
attribute under the service.
So the example can actually be modified to
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
container_name: app_app_1
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
```
How could I this be used to just restart a portainer container after a system reboot - possibly with a 20 sec delay after the reboot has happened
I have added the proposed lines and edited "app_app_1".
But I get this error:
No log line matching the '' filter
@BulldozerPete it's not an error, there are just no logs for the container.
@kizzx2 Thats Work as simple as that
thanks