Enable generating compose files for containers that aren't running.

This commit is contained in:
Red5d
2021-08-07 13:51:02 -04:00
committed by GitHub
parent 94ca597f3d
commit 8ada367b9e

View File

@@ -30,9 +30,9 @@ def generate(cname):
c = docker.from_env() c = docker.from_env()
try: try:
cid = [x.short_id for x in c.containers.list() if cname == x.name or x.short_id in cname][0] cid = [x.short_id for x in c.containers.list(all=True) if cname == x.name or x.short_id in cname][0]
except IndexError: except IndexError:
print("That container is not running.") print("That container is not available.")
sys.exit(1) sys.exit(1)
cattrs = c.containers.get(cid).attrs cattrs = c.containers.get(cid).attrs