Docker-Compose lab

I am getting below error for docker-compose where I have provided both the docker-composer.yml file and the error below

$ cat docker-compose.yml
db:
image: postgres
wordpress:
image: wordpress
ports:

  • 8085:80
    links:
  • db

$ sudo docker-compose up
Creating root_db_1 …
Creating root_db_1 … done
Creating root_wordpress_1 …
Creating root_wordpress_1 … error

ERROR: for root_wordpress_1 Cannot start service wordpress: Cannot link to a non running container: /root_db_1 AS /root_wordpress_1/db

ERROR: for wordpress Cannot start service wordpress: Cannot link to a non running container: /root_db_1 AS /root_wordpress_1/db
ERROR: Encountered errors while bringing up the project.

Hi @anujmittal42,

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!