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)