Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Docker Compose compatibility with v1 removal #399

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions providers/docker/units/docker.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yphus

the expected result from the above is yaml file that looks like this:

version: '1'
services:
  test:
    image: ubuntu
    command: bash
    tty: true

Meaning version & services are top level keys. The error messages in the checkbox output suggest that above is producing yaml of this form

version: '2'
  services:
    test:
      ....

as if services is not a top level key.

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
Expand All @@ -274,10 +276,12 @@ command:
set -e
#read content from stdin
yml=$(cat <<EOF
test:
image: ubuntu
command: bash
tty: true
version: '2'
services:
test:
image: ubuntu
command: bash
tty: true
EOF
)
echo "$yml" | {compose_command} -f - pull
Expand Down Expand Up @@ -413,10 +417,12 @@ command:
export -n PYTHONHOME PYTHONUSERBASE PYTHONPATH
set -e
compose_file={root_dir}/docker-compose.yaml
echo "test:
image: ubuntu
command: sleep 1
restart: always" > $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)
Expand Down