turn on container
This commit is contained in:
parent
0229e8fff7
commit
9248218bfd
@ -7,6 +7,7 @@ class DockerManager:
|
||||
|
||||
def __init__(self):
|
||||
self.client = docker.from_env()
|
||||
self.image = 'felixlohmeier/openrefine'
|
||||
|
||||
def create_new_volume(self, username):
|
||||
# Hashing username to get volume name
|
||||
@ -15,11 +16,14 @@ class DockerManager:
|
||||
# Creating volume in docker
|
||||
volume = self.client.volumes.create(name=hashed_username, driver='local')
|
||||
|
||||
return hashed_username
|
||||
return volume.id
|
||||
|
||||
def turn_on_container(self, volume_id):
|
||||
pass
|
||||
|
||||
|
||||
def turn_off_container(self,volume_id):
|
||||
def turn_on_container(self, volume_id, port):
|
||||
container = self.client.containers.run(self.image, detach=True,
|
||||
volumes={volume_id: {"bind": "/data", "mode": "rw"}})
|
||||
|
||||
return container.id
|
||||
|
||||
|
||||
def turn_off_container(self, volume_id, port):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user