-
Notifications
You must be signed in to change notification settings - Fork 177
Description
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-composeis1.29.2-1. That is older thandocker composeversion2.10.2which 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