#!/bin/bash . $(pwd)/sh/config.sh ENV=$(cat "$(pwd)/env") # 使用if-elif-else结构判断环境 if [ "$ENV"=="produce" ]; then ADDRESS="${PRODUCE_ADDRESS}" elif [ "$ENV"=="test" ]; then ADDRESS="${TEST_ADDRESS}" else ADDRESS="${PRODUCE_ADDRESS}" fi echo docker pull ${ADDRESS}:${VERSION} echo rm -f "${CONTAINER}" echo docker run -it -p "${PORT}:${PORT}" --net transfer --name "${CONTAINER}" "${ADDRESS}:${VERSION}"