Open Mondo1111 opened 1 year ago
Hello @Mondo1111 I saw you're using a one year old version of Compose, within a year we did a bunch of improvements and corrections. Can you try to reproduce your issue with a more recent version of Compose please. Here a link to the last version
@Mondo1111 From your snippet, it looks like your tar
command is the one that hasn't exited before docker compose start
starts running, right?
Hi,
Sorry for the late reply.
You're right @laurazard , that's what the snippet shows. It is actually a different behaviour than usual.
Thank you @glours for the insight. It is currently running in production, so I will have to test it on another environment.
Description
I believe there is an issue with the command
docker compose start
. While the Python commandsubprocess.check_output
waits for the end of the command to continue the script, the script continues even ifdocker compose start
didn't finish to run.Steps To Reproduce
import subprocess import os from colorama import Fore from colorama import Style
dockers_stop = ["docker compose -f /usr/local/data/zabbix-docker-postrgresql-6.0/zabbix-docker/docker-compose_v3_alpine_pgsql_latest_flexilab.yaml --profile flexilab stop"] tar_command = ["tar -czvf /zabbix-backup/backup-zabbix-pgsql.tar.gz /usr/local/data/zabbix-docker-postrgresql-6.0/zabbix-docker/"] dockers_start = ["docker compose -f /usr/local/data/zabbix-docker-postrgresql-6.0/zabbix-docker/docker-compose_v3_alpine_pgsql_latest_flexilab.yaml --profile flexilab start"]
docker_commands = [dockers_stop, tar_command, dockers_start]
print(f"{Fore.RED}Zabbix backup!!! Don't restart Zabbix\n The result of the tar will be shown in the end of the archiving{Style.RESET_ALL}")
for docker_user_commands in docker_commands: for command in docker_user_commands: print(f"{Fore.GREEN}Command inserted:{Style.RESET_ALL}", command) output = subprocess.check_output(command, shell=True, universal_newlines=True).splitlines() print(*output, sep='\n')
print(f"{Fore.RED}Zabbix backup is done!!!{Style.RESET_ALL}")
Docker Environment
Anything else?
Faulty output snippet: