Not sure why this task was marked failed - I believe I met all requirements and confirmed it was working as expected before submitting. I also tried redoing it once, thinking maybe the issue was that I had started and left the container running (on the redo, I stopped/removed the container and image before submitting).
I suspect it’s related to the lab check using “docker-compose up” instead of “docker compose up”, since when I tried with “docker compose up” it works without issues.
Please add the version on your docker compose, without version on the docker compose file he takes by default v1. Based on your docker engine, you need to specify the right version.
I appreciate the tip and it will likely satisfy the KodeKloud task, but please note the page you’ve linked to is for legacy docker-compose implementations:
From the updated docs it seems the absence of version means use the latest (Version and name top-level element | Docker Documentation): " The top-level
version property is defined by the Compose Specification for backward compatibility. It is only informative. Compose doesn’t use
version to select an exact schema to validate the Compose file, but prefers the most recent schema when it’s implemented."
Should the exercise be updated to use docker compose CLI instead of legacy docker-compose (or at the very least, make it well-noted on the task which version of docker-compose should be used)? Please note from my original screenshot that I was able to start the container using my compose file as-is with “docker compose up” (but fails the task check which apparently uses “docker-compose up”).
Not sure why docker container build is getting stucked while I used to create using docker-compose file. Can someone help on this. Thanks
docker container build is NOT
Read this: docker compose up | Docker Docs
When the command exits, all containers are stopped. Running
docker compose up --detach starts the containers in the background and leaves them running.
You are not stuck. You just see output from docker compose online.
If you want to detach from it, you should run compose with -d option:
docker compose up -d
Thanks Bhard . Yes it’s working.