diff --git a/docker-compose.yml b/docker-compose.yml
index ecbb9440107300aaaf6be67765738728e2db5cb7..4ef10687b7659db1cf474ff8966cbd7bb29dd437 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -33,7 +33,13 @@ services:
     volumes:
       - ${data}/db:/var/lib/postgresql/data
     command: postgres -c fsync=off -c synchronous_commit=off -c full_page_writes=off -c random_page_cost=1.0
-
+    #Checking health of Postgres db
+    healthcheck:
+      test: ["CMD-SHELL", "pg_isready -U ${dbUser}"]
+      interval: 5s
+      timeout: 5s
+      retries: 5
+      
   frontend:
     image: reallibrephotos/librephotos-frontend:${tag}
     container_name: frontend
@@ -74,7 +80,8 @@ services:
 
     # Wait for Postgres
     depends_on:
-      - db
+      db:
+        condition: service_healthy
 
   redis:
     image: redis:6