Docker Community Forums

Share and learn in the Docker community.

Docker Compose with two services downloads image of first image but doesn't initiate a container

Hello,

My docker-compose file looks like below-

version: ‘3’

services:
postgres:
image: postgres
….

app:
build:
context: .
dockerfile: my_dockerfile
args:
- …
depends on:
- postgres

Expected - i) The postgres image downloads ii) Postgres container initiates iii) application image builds from dockerfile iv) application container starts

Current Issue- i) The postgres image downloads ii) Postgres container doesn’t initiate iii) application image starts building using dockerfile, but fails as it has dependency on 1st(postgres) service.

Could someone please let me know where I am wrong.

Thanks in advance.