Sign inSign up

jmqm/docker_container_restarter

By jmqm

•Updated about 4 years ago

Restarts Docker containers automatically on a schedule.

Image
0

1.3K

jmqm/docker_container_restarter repository overview

Restarts Docker containers automatically on a schedule.

⁠docker-compose

services:
  container:
    # Container configuration here.

  backup:
    image: jmqm/docker_container_restarter:latest
    container_name: container_restarter
    network_mode: none
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

      - /etc/localtime:/etc/localtime:ro # Container uses date from host.
    environment:
      - CONTAINERS=container # One or more, separated by spaces
      - OPTIONS=--time 300 # Five minutes to wait before killing container(s)
      - SCHEDULE=0 5 * * * # 5:00 AM daily
    depends_on
      - container

⁠Volumes (permission required)

  • /var/run/docker.sock (read/write)

⁠Environment Variables

Environment VariableInfo
CONTAINERS ⭐Name of the containers to restart, separated by commas.
SCHEDULE ⭐When to run (default is 5:00 AM). Info here⁠ and editor here⁠.
OPTIONS 👍Options to pass to command docker restart. Docs here⁠.
⁠Optional
Environment VariableInfo
TZ ¹Timezone inside the container. Can mount /etc/localtime instead as well (recommended).

¹ See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones⁠ for more information

⁠Take note of...

  • All shell scripts are being ran as root.

Tag summary

Content type

Image

Digest

sha256:49277d61f…

Size

16.2 MB

Last updated

about 4 years ago

docker pull jmqm/docker_container_restarter