mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 09:51:06 +00:00
Update container.py
This commit is contained in:
parent
066c297adc
commit
9b70581a67
|
@ -8,14 +8,17 @@ class Container(Extension):
|
||||||
self.method = "container_init"
|
self.method = "container_init"
|
||||||
self.exported_methods = ["container_run", "container_stop"]
|
self.exported_methods = ["container_run", "container_stop"]
|
||||||
|
|
||||||
|
# docker
|
||||||
|
self.client = docker.from_env()
|
||||||
|
|
||||||
def dispatch(self, type, id, params, conn):
|
def dispatch(self, type, id, params, conn):
|
||||||
print ("[*] Greeting! dispatch")
|
print ("[*] Greeting! dispatch")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def container_run(self, type, id, params, conn):
|
def container_run(self, type, id, params, conn):
|
||||||
print ("[*] Greeting! container_run")
|
image = params['image']
|
||||||
# todo
|
container = client.containers.run(image, detach=True)
|
||||||
pass
|
container.logs()
|
||||||
|
|
||||||
def container_stop(self, type, id, params, conn):
|
def container_stop(self, type, id, params, conn):
|
||||||
print ("[*] Greeting! container_stop")
|
print ("[*] Greeting! container_stop")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user