|
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|
|
from django.conf import settings
|
|
|
from docker import DockerClient
|
|
|
from docker.errors import DockerException, NotFound, APIError
|
|
|
+import time
|
|
|
|
|
|
'''
|
|
|
'''
|
|
@@ -67,6 +68,9 @@ def start_container(id=None):
|
|
|
try:
|
|
|
container = client.containers.get(id)
|
|
|
container.start()
|
|
|
+
|
|
|
+ time.sleep(1)
|
|
|
+
|
|
|
container.reload()
|
|
|
|
|
|
return {
|
|
@@ -96,6 +100,9 @@ def restart_container(id=None):
|
|
|
try:
|
|
|
container = client.containers.get(id)
|
|
|
container.restart()
|
|
|
+
|
|
|
+ time.sleep(1)
|
|
|
+
|
|
|
container.reload()
|
|
|
|
|
|
return {
|
|
@@ -125,6 +132,9 @@ def stop_container(id=None):
|
|
|
try:
|
|
|
container = client.containers.get(id)
|
|
|
container.stop()
|
|
|
+
|
|
|
+ time.sleep(1)
|
|
|
+
|
|
|
container.reload()
|
|
|
|
|
|
return {
|