update support for docker compose v2 (#17039)

updte supportt for docker compose v2

Signed-off-by: yminer <yminer@vmware.com>

adjust install.sh

Signed-off-by: yminer <yminer@vmware.com>
This commit is contained in:
MinerYang 2022-06-21 16:55:07 +08:00 committed by GitHub
parent a594f5649d
commit 541fbe784f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -113,6 +113,7 @@ function check_dockercompose {
if docker compose version &> /dev/null
then
note "$(docker compose version)"
DOCKER_COMPOSE="docker compose"
# or docker-compose has been installed, check its version
elif [[ $(docker-compose --version) =~ (([0-9]+)\.([0-9]+)([\.0-9]*)) ]]

View File

@ -22,6 +22,9 @@ with_trivy=$false
# chartmuseum is not enabled by default
with_chartmuseum=$false
# flag to using docker compose v1 or v2, default would using v1 docker-compose
DOCKER_COMPOSE=docker-compose
while [ $# -gt 0 ]; do
case $1 in
--help)
@ -88,14 +91,14 @@ fi
./prepare $prepare_para
echo ""
if [ -n "$(docker-compose ps -q)" ]
then
note "stopping existing Harbor instance ..."
docker-compose down -v
if [ -n "$DOCKER_COMPOSE ps -q" ]
then
note "stopping existing Harbor instance ..."
$DOCKER_COMPOSE down -v
fi
echo ""
h2 "[Step $item]: starting Harbor ..."
docker-compose up -d
$DOCKER_COMPOSE up -d
success $"----Harbor has been installed and started successfully.----"