# remove-container.py
# Removal of a docker container
#

import json
import subprocess
import argparse

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Removal of a container"
    )
    parser.add_argument("--conffile", required=True, type=str)
    args = parser.parse_args()

    print("Parsing configuration file : " + args.conffile)

    # Open and read the JSON file
    with open(args.conffile, 'r') as file:
        data = json.load(file)

    container = data['container']['name']

    subprocess.call(f'docker stop {container}', shell=True)
    subprocess.call(f'docker rm {container}', shell=True)

