traefik-helper/src/utils/dockerUtils.py
2024-01-15 22:59:08 +00:00

19 lines
508 B
Python

import subprocess
import os
containerName = "traefik"
if os.environ.get("CONTAINER_NAME"):
containerName = os.environ.get("CONTAINER_NAME")
def restartTraefik():
# Check if we're in Windows, if so, don't restart Traefik
if os.name == "nt":
print("Restarting Traefik is not supported on Windows.")
return
print("Restarting Traefik, please wait this can take a while...")
# Restart Traefik in the base directory
subprocess.run(["docker", "restart", containerName])
print("Done!")