#!/bin/bash # 读取docker.conf文件 source docker.conf # 设置系统环境变量 export WORKERMAN_CONTAINER_NAME=$container_name export WORKERMAN_IMAGE_VERSION=$image_version # 判断WORKERMAN_CONTAINER_NAME的docker容器是否存在,如果存在,删除它 if docker ps -a --format '{{.Names}}' | grep -q "^$WORKERMAN_CONTAINER_NAME$"; then docker rm -f $WORKERMAN_CONTAINER_NAME fi docker compose run --rm $WORKERMAN_CONTAINER_NAME composer install # 根据参数执行docker compose up命令 if [[ $1 == "-d" ]]; then docker compose up -d else docker compose up fi