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

Create a cron job to run and cleanup any docker images that have not been run recently. #10

Open
benjaminkostiuk opened this issue May 27, 2021 · 4 comments
Labels
feature Feature or improvement priority:medium Medium priority work item

Comments

@benjaminkostiuk
Copy link
Member

We create a new docker image tagged with each submission id (source files) so if the user submits new code it will most likely never be needed again. We need a cron job to run and delete images that have not been used in the last 6 hours? less?.

Need to create new function in the docker service that a scheduled job can use to delete the images.

@benjaminkostiuk benjaminkostiuk added feature Feature or improvement priority:medium Medium priority work item labels May 27, 2021
@OZoneGuy
Copy link
Contributor

You can mount the submission folder, this will reuse the docker images without having to create new ones (assuming nothing major changes, like requirements.txt for python). This should reduce the number of docker images.

Alternatively, have precreated images for different courses/assignments. This could require some work with course instructors/TAs. Or we can have trusted users submit images/image settings.

For some things, where the projects/submissions could vary wildly, we can allow custom images. Doesn't solve the problem entirely, but reduces it signigicantly, I believe.

Some relevant docker links:

@benjaminkostiuk
Copy link
Member Author

I remember I was concerned about the security vulnerability of mounting the source code files and their ability to get traceback to the host system and cause havok. If we could securely do it with read-only volumes allowing the files to still execute properly (reading, writing binaries etc.) then I'd be okay with it.

@OZoneGuy
Copy link
Contributor

OZoneGuy commented Jul 19, 2021

I doubt that that could be an issue (even without read-only access), but I will look it up to double-check. That being said, I think we should look into volumes. Very similar to mounting system files, with a few differences; the biggest one is that we can mount volumes that exist on a different machine/host. Meaning, we can store all tests/source code on a safe machine away from the actual server host and mount from there. Check the first point, third from last, here.

Besides, only root and docker user have access to the docker directory under /var/lib/docker/, so normal users shouldn't have access to it.

Doesn't have to be a priority, but I really think the volume/mount approach is better than having to schedule a repeating container/image purge.

@benjaminkostiuk
Copy link
Member Author

👍 Yeah I like this idea a lot more than having to repeatly build a new image and having to worry about managing images. I will work on fixing this asap (after the tests + styling is fixed) then we can follow the same model for Haskell & Java. For the moment I'll use volumes just from the host system and can improve the security later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature or improvement priority:medium Medium priority work item
Projects
None yet
Development

No branches or pull requests

2 participants