From 9a50449d585ab55c9cf5b798710ced12fa238d74 Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Wed, 4 Jun 2025 21:33:16 +0200 Subject: [PATCH] fix bug when starting multiple instances in team mode --- docker_challenges/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker_challenges/__init__.py b/docker_challenges/__init__.py index 04f9ef1..9dd98fd 100644 --- a/docker_challenges/__init__.py +++ b/docker_challenges/__init__.py @@ -597,8 +597,12 @@ def get(self): # Check if a container is already running for this user. We need to recheck the DB first containers = DockerChallengeTracker.query.all() for i in containers: - if int(session.id) == int(i.user_id): - return abort(403,f"Another container is already running for challenge:
{i.challenge}.
Please stop this first.
You can only run one container.") + if is_teams_mode(): + if int(session.id) == int(i.team_id): + return abort(403,f"Another container is already running for challenge:
{i.challenge}.
Please stop this first.
You can only run one container.") + else: + if int(session.id) == int(i.user_id): + return abort(403,f"Another container is already running for challenge:
{i.challenge}.
Please stop this first.
You can only run one container.") portsbl = get_unavailable_ports(docker) create = create_container(docker, container, session.name, portsbl)