Skip to content

docker-compose.yml not compatible with Docker Compose v2? #82

@justincr-elastic

Description

@justincr-elastic

The docker-compose build command in README.md did not work for me. I think root cause is Docker v20 includes newer Docker Compose v2, and docker-compose.yml is only compatible with Docker Compose v1.

I am running Ubuntu 22.04 x86_64 LTS. I used the install instructions on Docker's website for Ubuntu.

I was able to update docker-compose.yml to make it work with Docker Compose v2. I am sharing in case anyone else runs into this issue.

Steps to reproduce:

Install Docker latest version. Check Docker and Docker Compose installed version on Ubuntu 22.04 x86_64 LTS.

$ docker --version
Docker version 20.10.18, build b40c2f6
$ docker compose version
Docker Compose version v2.10.2

Install saml-idp. When I get to the docker-compose build step, it fails because the docker-compose command is not found.

$ docker-compose build
Command 'docker-compose' not found, but can be installed with:
sudo snap install docker          # version 20.10.17, or
sudo apt  install docker-compose  # version 1.29.2-1
See 'snap info docker' for additional versions.
  • Notice the latest available version of docker-compose is 1.29.2-1. That is older than docker compose version 2.10.2 which came with Docker v20.10.18. The new v2 command seems to have a space instead of a dash.

Try to build with Docker Compose v2. It fails with a cryptic error.

$ docker compose build
(root) Additional property saml-idp is not allowed

Update docker-compose.yml to make it compatible with Docker Compose v2 (insert service, replace net with network_mode)

$ cat <<EOF > ./docker-compose.yml
services:
  saml-idp:
    build: .
    ports:
      - "7000:7000"
    network_mode: "host"
EOF

Build with Docker Compose v2. It works.

$ docker compose build
[+] Building 9.1s (15/15) FINISHED

Build with Docker Compose v2. It works.

$ docker compose up
[+] Running 1/0
 ⠿ Container saml-idp-saml-idp-1  Created                                                       0.0s
Attaching to saml-idp-saml-idp-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions