Add pause,unpause commands support

Signed-off-by: Mohammed Tayeh <info@tayeh.me>
This commit is contained in:
Mohammed Tayeh 2022-06-30 15:04:48 +03:00 committed by Muayyad Alsadi
parent f7d335dc6a
commit 10580db329
2 changed files with 12 additions and 2 deletions

View File

@ -62,12 +62,10 @@ def compose_up(compose, args):
images List images images List images
kill Kill containers kill Kill containers
logs View output from containers logs View output from containers
pause Pause services
port Print the public port for a port binding port Print the public port for a port binding
ps List containers ps List containers
rm Remove stopped containers rm Remove stopped containers
run Run a one-off command run Run a one-off command
scale Set number of containers for a service scale Set number of containers for a service
top Display the running processes top Display the running processes
unpause Unpause services
``` ```

View File

@ -2344,6 +2344,18 @@ def compose_port(compose, args):
print(published) print(published)
return return
@cmd_run(podman_compose, 'pause', 'Pause all running containers')
def compose_pause(compose, args):
containers = list(reversed(compose.containers))
for container in containers:
compose.podman.run(['pause'], container['name'])
@cmd_run(podman_compose, 'unpause', 'Unpause all running containers')
def compose_pause(compose, args):
containers = list(reversed(compose.containers))
for container in containers:
compose.podman.run(['unpause'], container['name'])
################### ###################
# command arguments parsing # command arguments parsing