fix: ignore none swarm container #52

This commit is contained in:
Moritz 2024-07-05 14:41:50 +02:00
parent 68e37f5c23
commit b7bc8ed58f

View File

@ -108,7 +108,7 @@ def create(retries):
def get_backup_cmds():
client = docker.from_env()
container_by_service = {
c.labels['com.docker.swarm.service.name']: c for c in client.containers.list()}
c.labels.get('com.docker.swarm.service.name'): c for c in client.containers.list()}
backup_paths = set()
backup_apps = set()
pre_commands = {}
@ -143,7 +143,7 @@ def copy_secrets(apps):
os.mkdir(SECRET_PATH)
client = docker.from_env()
container_by_service = {
c.labels['com.docker.swarm.service.name']: c for c in client.containers.list()}
c.labels.get('com.docker.swarm.service.name'): c for c in client.containers.list()}
services = client.services.list()
for s in services:
app_name = s.attrs['Spec']['Labels']['com.docker.stack.namespace']