Add --restart feature. This restarts the container (killing any processes running in it)
This commit is contained in:
parent
2e16523810
commit
f43ac055c2
10
otherworld
10
otherworld
@ -93,6 +93,9 @@ def docker_commit (container, image_name):
|
||||
def docker_rm (container):
|
||||
call(["docker", "rm", "-f", container])
|
||||
|
||||
def docker_restart (container):
|
||||
call(["docker", "restart", container])
|
||||
|
||||
def docker_rmi (container):
|
||||
call(["docker", "rmi", "-f", container])
|
||||
|
||||
@ -151,6 +154,9 @@ def parse_command_line (command, config=None):
|
||||
elif arg == "--rm":
|
||||
config['actions'].append("rm")
|
||||
command = command[1:]
|
||||
elif arg == "--restart":
|
||||
config['actions'].append("restart")
|
||||
command = command[1:]
|
||||
elif arg == "--rmi":
|
||||
config['actions'].append("rmi")
|
||||
command = command[1:]
|
||||
@ -289,6 +295,10 @@ if actions:
|
||||
log("Committing container: {} to image: {}", container_name, target_image_name)
|
||||
docker_commit(container_name, target_image_name)
|
||||
|
||||
if "restart" in actions:
|
||||
log("Restarting container: {}", container_name)
|
||||
docker_restart(container_name)
|
||||
|
||||
if "rm" in actions:
|
||||
log("Removing container: {}", container_name)
|
||||
docker_rm(container_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user