container exception

This commit is contained in:
qiaofeng1227 2023-06-02 11:03:16 +08:00
parent 0b2130fc36
commit 12d0c283a7
2 changed files with 13 additions and 5 deletions

View file

@ -10,7 +10,7 @@ COPY static ./static
COPY requirements.txt main.py ./
RUN apt update
# Install supervisord
# Install supervisords
RUN apt install -y supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/cmd.sh /cmd.sh

View file

@ -146,11 +146,19 @@ def delete_app(app_id):
lib_path = '/data/library/apps/' + app_name
if app_path != lib_path:
cmd = cmd + " && sudo rm -rf " + app_path
shell_execute.execute_command_output_all(cmd)
try:
myLogger.info_logger("Intall fail, down app and delete files")
shell_execute.execute_command_output_all(cmd)
except Exception:
myLogger.info_logger("Delete app compose exception")
# 强制删除失败又无法通过docker compose down 删除的容器
force_cmd = "docker rm -f $(docker ps -f name=^"+customer_name+" -aq)"
shell_execute.execute_command_output_all(force_cmd)
try:
myLogger.info_logger("IF delete fail, force to delete containers")
force_cmd = "docker rm -f $(docker ps -f name=^"+customer_name+" -aq)"
shell_execute.execute_command_output_all(force_cmd)
except Exception:
myLogger.info_logger("force delete app compose exception")
else:
if check_app_rq(app_id):
delete_app_failedjob(app_id)