support docker without kvm (#282)
This commit is contained in:
@@ -97,11 +97,20 @@ class DockerProvider(Provider):
|
|||||||
self.vlc_port = self._get_available_port(8080)
|
self.vlc_port = self._get_available_port(8080)
|
||||||
|
|
||||||
# Start container while still holding the lock
|
# Start container while still holding the lock
|
||||||
|
# Check if KVM is available
|
||||||
|
devices = []
|
||||||
|
if os.path.exists("/dev/kvm"):
|
||||||
|
devices.append("/dev/kvm")
|
||||||
|
logger.info("KVM device found, using hardware acceleration")
|
||||||
|
else:
|
||||||
|
self.environment["KVM"] = "N"
|
||||||
|
logger.warning("KVM device not found, running without hardware acceleration (will be slower)")
|
||||||
|
|
||||||
self.container = self.client.containers.run(
|
self.container = self.client.containers.run(
|
||||||
"happysixd/osworld-docker",
|
"happysixd/osworld-docker",
|
||||||
environment=self.environment,
|
environment=self.environment,
|
||||||
cap_add=["NET_ADMIN"],
|
cap_add=["NET_ADMIN"],
|
||||||
devices=["/dev/kvm"],
|
devices=devices,
|
||||||
volumes={
|
volumes={
|
||||||
os.path.abspath(path_to_vm): {
|
os.path.abspath(path_to_vm): {
|
||||||
"bind": "/System.qcow2",
|
"bind": "/System.qcow2",
|
||||||
|
|||||||
Reference in New Issue
Block a user