class ready
This commit is contained in:
parent
01dc798a5f
commit
638d9aceb5
@ -4,7 +4,6 @@ import hashlib
|
|||||||
|
|
||||||
|
|
||||||
class DockerManager:
|
class DockerManager:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.client = docker.from_env()
|
self.client = docker.from_env()
|
||||||
self.image = 'felixlohmeier/openrefine'
|
self.image = 'felixlohmeier/openrefine'
|
||||||
@ -20,10 +19,11 @@ class DockerManager:
|
|||||||
|
|
||||||
def turn_on_container(self, volume_id, port):
|
def turn_on_container(self, volume_id, port):
|
||||||
container = self.client.containers.run(self.image, detach=True,
|
container = self.client.containers.run(self.image, detach=True,
|
||||||
volumes={volume_id: {"bind": "/data", "mode": "rw"}})
|
volumes={volume_id: {"bind": "/data", "mode": "rw"}},
|
||||||
|
ports={'3333': port})
|
||||||
return container.id
|
return container.id
|
||||||
|
|
||||||
|
def turn_off_container(self, container_id):
|
||||||
def turn_off_container(self, volume_id, port):
|
container = self.client.containers.get(container_id)
|
||||||
pass
|
container.stop()
|
||||||
|
container.remove()
|
||||||
|
@ -11,3 +11,4 @@ class Session(models.Model):
|
|||||||
class Profile(models.Model):
|
class Profile(models.Model):
|
||||||
user = models.ForeignKey(User, primary_key=True, on_delete=models.CASCADE)
|
user = models.ForeignKey(User, primary_key=True, on_delete=models.CASCADE)
|
||||||
volume = models.CharField(max_length=64)
|
volume = models.CharField(max_length=64)
|
||||||
|
container_id = models.CharField(max_length=64)
|
||||||
|
Loading…
Reference in New Issue
Block a user