X
X
xopxe2015-09-01 21:45:52
Virtualization
xopxe, 2015-09-01 21:45:52

Do I need to create a new lxc(docker) container for every new task I want to isolate?

I need to write a backend for a programming competition.
Participants submit their solutions (code) to the server for verification. It is necessary that they do not get out of the sandbox in the process of execution.
Two questions:
1. Should I use Docker or lxc?
I've read a couple of articles about their differences, but it's still not clear to me which is better for my needs.
2. If I use lxc, do I understand correctly that for each new submit that I want to run and check, I need to do the following:

#!/usr/bin/python3
c = lxc.Container("apicontainer")

# или c.clone(...)
c.create("download", lxc.LXC_CREATE_QUIET, {"dist": "ubuntu",
                                               "release": "trusty",
                                               "arch": "i386"})
c.start()
c.execute('score_solution_script_inside_container')
c.shutdown()
c.destroy()

It seems to take quite a lot of time, perhaps you need to act differently?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Zhivotnev, 2015-09-02
@inkvizitor68sl

try porto.
And so - both docker and lxc will do.
In lxc, you can create a container from a local archive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question