Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docker_challenges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:<br><i><b>{i.challenge}</b></i>.<br>Please stop this first.<br>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:<br><i><b>{i.challenge}</b></i>.<br>Please stop this first.<br>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:<br><i><b>{i.challenge}</b></i>.<br>Please stop this first.<br>You can only run one container.")

portsbl = get_unavailable_ports(docker)
create = create_container(docker, container, session.name, portsbl)
Expand Down