Skip to content

fix bug when starting multiple instances in team mode #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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