Unable to pass the test case: Wordpress linked to db container in Docker compose Lab

In Docker compose lab exercise,though i linked wordpress to db container, its not reflecting in quiz portal.Not able to pass the test case:wordpress linked to db container.Please confirm whether my docker compose file is correct or do i need to change it? Please advise… Thanks

Same here! At least now I know my yaml code is right. This was driving me crazy!

1 Like

Hi there, can you clarify if you created the docker compose file under /root/wordpress as stated in the question?

If so, is the config validate working? try:
docker-compose -f /root/wordpress/docker-compose.yml config

Hi Even i am able to connect to wordpress.But the test case is not passing

Able to connect after running docker-compose up

My answer:

db:
image: postgres
environment:
POSTGRES_PASSWORD: mysecretpassword
wordpress:
image: wordpress
ports:
- 8085:80
links:
- db

The result:
X WordPress linked to db container

Try many times.

I am getting the result. But in labs page unabe to pass the testcase

Also you want me to try docker-compose up many times or click the check button many times? Tried both.

Hi - its good that its working, but I also wanted to check if you have the docker compose file in the same directory thats mentioned in the question?

The test also validates that.

Yeah. Its in the mentioned directory only.

I am also getting the same issue when creating container through docker-compose .
also does any one know
1- how to check if container is linked with which other containers ?
2-how to link running containers ?

I am also facing the same issue .Even though I am running from the path mentioned in the question .
Can anyone please look into it as many are affected now from the same problem

docker check program:
docker container inspect wordpress | jq ‘.[] | .HostConfig.Links’ | grep db
docker-compose check program:
docker container inspect wordpress_wordpress_1 | jq ‘.[] | .NetworkSettings.Networks.wordpress_default.Links’ | grep db

,so we need to use different method to pass the exam.

docker-compose.yaml

version: “2”

services:

db:
image: postgres
environment:
POSTGRES_PASSWORD: mysecretpassword
wordpress:
image: wordpress
links:
- db:db
ports:
- “8085:80”

1 Like

dockercompose捕获

this worked for me as well. version 1 wouldnt work, but version 2 did.

Hi All,
Kindly check the full solution below :

services:
 db:
   environment:
     POSTGRES_PASSWORD: mysecretpassword
   image: postgres
 wordpress:
   image: wordpress
   links:
   - db
   ports:
   - 8085:80
version: '3.0'

Also, check my try below:

Sometimes the correct answer is located under path /var/answers/ as you can find the above answer inside it.

We do sorry for any inconvenience.

I hope this helps!