From e1b909a83ec4c356dfdc25356d7546138c31776e Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Thu, 30 Mar 2023 14:41:56 +0100 Subject: [PATCH] Fix: Docker Compose compatibility with v1 removal --- providers/docker/units/docker.pxu | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/providers/docker/units/docker.pxu b/providers/docker/units/docker.pxu index abc7fccd1f..cd25db3d45 100644 --- a/providers/docker/units/docker.pxu +++ b/providers/docker/units/docker.pxu @@ -249,10 +249,12 @@ command: export -n PYTHONHOME PYTHONUSERBASE PYTHONPATH set -e compose_file={root_dir}/docker-compose.yaml - echo "test: - image: ubuntu - command: bash - tty: true" > $compose_file + echo "version: '2' + services: + test: + image: ubuntu + command: bash + tty: true" > $compose_file {compose_command} -f $compose_file up -d ID=$({compose_command} -f $compose_file ps -q test) [ `docker inspect -f {status} $ID` != running ] && exit 1 @@ -274,10 +276,12 @@ command: set -e #read content from stdin yml=$(cat < $compose_file + echo "version: '2' + services: + test: + image: ubuntu + command: sleep 1 + restart: always" > $compose_file {compose_command} -f $compose_file up -d ID=$({compose_command} -f $compose_file ps -q test) restartPolicy=$(docker inspect -f {restartPolicy} $ID)