Closed mathieu-lemay closed 7 months ago
Thank you @mathieu-lemay for adding the proper healthcheck, The PR is merged.
@mathieu-lemay, I've just started Docker and received an error:
theowni:~/Damn-Vulnerable-RESTaurant-API-Game$ ./start_game.sh
/usr/bin/docker-compose:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import load_entry_point
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.web.depends_on contains an invalid type, it should be an array
/usr/bin/docker-compose:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import load_entry_point
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.web.depends_on contains an invalid type, it should be an array
The issue is related with deprecated long form on depends_on
in Docker Compose v3 and I had to use shorter form. You can check the code after my commit with fix.
btw. I need to setup GitHub Actions to catch such issues in automated way.
@theowni I think it's actually the opposite, in compose v2, only the short form was supported, but now the long form is too: https://docs.docker.com/compose/compose-file/05-services/#long-syntax-1
I'll be able to validate on my side in about 1h, but I'm using the latest version of docker compose and it worked for me.
@theowni I can confirm that the long form is still valid when using the latest version of both docker compose (the software, v2.26.1) and docker compose (the file format, by removing the version
tag in the file).
I investigated the issue this morning and on my end the problem was related with Docker Compose V1 in use. Changing to "docker compose" from "docker-compose" solved the issue. As V1 is going to be deprecated in future, I updated the README to use Docker Compose V2. Also, I updated the docker-compose.yaml to add missing condition
based on your original commit.
Thanks for the input @mathieu-lemay!
The web service will crash if it is started before the database has finished its initialization. By adding a healthcheck to the
db
service we can delay the start ofweb
untildb
is healthy.