Skip to content

Commit

Permalink
Container restart var
Browse files Browse the repository at this point in the history
  • Loading branch information
thueske committed Feb 18, 2024
1 parent d542002 commit 466d2a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONTAINER_NAME_TO_RESTART=cron-1
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import docker
import docker, os
from docker.errors import APIError, NotFound

# Konfiguration
label_key = "ofelia.enabled"
label_value = "true"
container_name_to_restart = "cron"

container_name_to_restart = os.getenv('CONTAINER_NAME_TO_RESTART')
if not container_name_to_restart:
print("Die Umgebungsvariable 'CONTAINER_NAME_TO_RESTART' muss gesetzt sein.")
exit(1)

client = docker.from_env()

Expand Down

0 comments on commit 466d2a7

Please sign in to comment.