Docker compose yaml conf file for wordpress and postgres

Create a docker-compose.yml file under the path /root/wordpress . Once done, run a docker-compose up.

The compose file should have exact specification of the wordpress and db container

CHECK

  • Syntax Check for the docker-compose.yml
  • Wordpress running on the correct HostPort?
  • WordPress linked to db container
  • db container running with env variable POSTGRES_PASSWORD

Please write the yml conf file for this scenario, m not able to configure this scenario i.e (* WordPress linked to db container is not happening

my docker compose conf file is below:

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

version: "3.5"
services:
  wordpress:
         image: wordpress
         depends_on:
            - db
         ports:
           - 8085:80
         restart: always
 db:
   image: postgres
   environment:
       POSTGRES_PASSWORD: mysecretpassword