Skip to content

Instantly share code, notes, and snippets.

View jmarhee's full-sized avatar

jdm jmarhee

View GitHub Profile
@jmarhee
jmarhee / container_prune.py
Created February 15, 2021 01:19
Terminates containers running longer than an float-value number of hours.
from datetime import datetime
import os
import docker
import dateparser
STARTING_TIME = str(datetime.now()).split(" ")[0]+ "T" + str(datetime.now()).split(" ")[1] + "Z"
if os.environ.get('LIMIT_HOURS') is None:
LIMIT_HOURS = 2.0
else: