From 50e03ba565918ecd4b2c3bf56b62ea64d141a676 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Wed, 2 Nov 2022 16:59:44 +0000 Subject: [PATCH] closes #65 with simpler solution --- archivers/base_archiver.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/archivers/base_archiver.py b/archivers/base_archiver.py index 50fa588..3dc5ba1 100644 --- a/archivers/base_archiver.py +++ b/archivers/base_archiver.py @@ -214,6 +214,7 @@ class Archiver(ABC): browsertrix_home = os.path.join(os.getcwd(), "browsertrix-tmp") cmd = [ "docker", "run", + "--rm", # delete container once it has completed running "-v", f"{browsertrix_home}:/crawls/", # "-it", # this leads to "the input device is not a TTY" "webrecorder/browsertrix-crawler", "crawl", @@ -240,14 +241,6 @@ class Archiver(ABC): except Exception as e: logger.error(f"WACZ generation failed: {e}") return - try: - # TODO: is there a better way to manage the containers, like reusing? - # https://github.com/bellingcat/auto-archiver/issues/65 - cmd_clean_docker = 'docker rm $(docker ps -a -q --filter ancestor=webrecorder/browsertrix-crawler --format="{{.ID}}")' - logger.info(f"Cleaning docker containers: {cmd_clean_docker}") - os.system(cmd_clean_docker) - except Exception as e: - logger.error(f"Could not clean dangling docker containers: {e}") filename = os.path.join(browsertrix_home, "collections", collection, f"{collection}.wacz")