Skip to content
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

Improvements for safe-docker #354

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hannesbraun
Copy link
Contributor

@hannesbraun hannesbraun commented Sep 29, 2022

This adds a few improvements for executing checks using safe-docker:

  • ulimit options also work when using Docker.
  • safe-docker can now be used to run checkers even if Praktomat itself is already running inside a Docker container.
  • You can specify the path to the safe-docker script through the settings in case it's not available in your PATH (see SAFE_DOCKER_PATH).
  • The name of the image to use can now be specified (see DOCKER_IMAGE_NAME). This was previously disabled in the safe-docker script for security reasons. But as far as I know, submissions shouldn't be able to change this parameter. I think the flexibility is worth it when running multiple Praktomat instances on one machine or Docker host.
  • Optionally, you can write to the container's filesystem using DOCKER_CONTAINER_WRITABLE. This is useful, for example, when the container contains some Gradle projects that contain unit tests. If you check the student's submissions against such tests, Gradle attempts to write to the project directory.
  • Optionally, you can also prevent modifying the UID and GID for the user executing checks in the Docker container using DOCKER_UID_MOD.

I added the safe-docker script to this repository as the original script is not maintained anymore (see nomeata/safe-docker#3). Therefore, it's probably better if we maintain our own version of this script.

By the way, this is pretty much my first time working with Perl. If you spot any kind of weird code in the safe-docker script, feel free to let me know ;)

The tests don't pass because I didn't merge #348 into this branch.

This adds a modified version of the safe-docker script that allows for more flexibility. The new options are propagated to the settings. safe-docker can now also launch a checker container if Praktomat itself is running in a Docker container.
This allows mounting an additional directory into a checker container when using safe-docker.
@hannesbraun
Copy link
Contributor Author

hannesbraun commented Nov 2, 2022

I added a setting called DOCKER_CONTAINER_EXTERNAL_DIR that allows to mount a directory into the checker container (at /external). This is a convenient solution for accessing data (e.g. unit tests, ...) residing on the host without the need of copying the files into the image.

See 8db8301

This allows a checker container to access the (host's) network.
@hannesbraun
Copy link
Contributor Author

With e19b211, I also added a setting to allow accessing the network inside of a checker container. When using a tool like Stack (Haskell) for running a student's submission, such a setting may be required.

@ifrh
Copy link
Contributor

ifrh commented Dec 31, 2022

please add "removing the following lines" from README.md to the change set of this PR:

@hannesbraun
Copy link
Contributor Author

please add "removing the following lines" from README.md to the change set of this PR:

Done with 9dcfa7f

@ifrh
Copy link
Contributor

ifrh commented Jan 1, 2023

please add "removing the following lines" from README.md to the change set of this PR:

Done with 9dcfa7f

this PR fixes #358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants