diff --git a/docker-compose.yml b/docker-compose.yml
index 212118e141fde47c7806196928bb9bf927b5d067..31a50671b8b29fb75d3be8b39daa875a7c3e18e5 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,17 +1,17 @@
 version: '3.9'
 
 services:
-  database:
+  neo4j:
     build: ./neo4j
     environment:
       - NEO4J_AUTH=neo4j/test
+      - PASSWORD=test
     ports:
       - "7474:7474"
       - "7687:7687"
     volumes:
       - neo4j-import:/var/lib/neo4j/import
       - neo4j-data:/var/lib/neo4j/data
-    container_name: neo4j
   redis:
     image: "redis:7-alpine"
     ports:
@@ -20,10 +20,10 @@ services:
     build: ./sg-backend
     environment:
       - FRONTEND_URL="http://localhost"
-      - NEO4J_URI=neo4j://database:7687
+      - NEO4J_URI=neo4j://neo4j:7687
       - NEO4J_USER=neo4j
       - NEO4J_PASSWORD=test
-      - WAIT_HOSTS=database:7474
+      - WAIT_HOSTS=neo4j:7474
       - WAIT_HOSTS_TIMEOUT=300
       - WAIT_SLEEP_INTERVAL=3
       - WAIT_HOST_CONNECT_TIMEOUT=30
@@ -31,8 +31,10 @@ services:
     volumes:
       - ./sg-backend:/code
     depends_on:
-      - database
-      - redis
+      neo4j:
+        condition: service_healthy
+      redis:
+        condition: service_started
     ports:
       - "8000:8000"
   sg-frontend:
@@ -45,7 +47,8 @@ services:
     ports:
       - "5173:5173"
     depends_on:
-      - sg-backend
+      sg-backend:
+        condition: service_healthy
 volumes:
   neo4j-import:
   neo4j-data:
diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile
index c36362cf5603d81eeeea7997e43c2ed345f868a5..f608c89a27a59cd35a8f5ad0deccad66877abfc2 100755
--- a/neo4j/Dockerfile
+++ b/neo4j/Dockerfile
@@ -3,4 +3,6 @@ FROM neo4j:4.4
 COPY ./import /var/lib/neo4j/import
 COPY ./data /var/lib/neo4j/data
 
-EXPOSE 7474 7473 7687
\ No newline at end of file
+EXPOSE 7474 7473 7687
+
+HEALTHCHECK --interval=5s --timeout=30s --retries=5 CMD cypher-shell -u neo4j -p ${PASSWORD} 'RETURN 1' || exit 1
diff --git a/sg-backend/Dockerfile b/sg-backend/Dockerfile
index d6aa430b5fd33f1ec9a6d989c32cf7de417c3f8d..9bba4765eb7ebeb64a49b61587b3915b41750ecf 100644
--- a/sg-backend/Dockerfile
+++ b/sg-backend/Dockerfile
@@ -1,5 +1,8 @@
 FROM python:3.10-slim
 
+ARG FASTAPI_PORT_DEFAULT=8000
+ENV FASTAPI_PORT=${FASTAPI_PORT_DEFAULT}
+
 ENV POETRY_VERSION=1.2
 ENV WAIT_VERSION 2.7.2
 
@@ -16,6 +19,10 @@ COPY . /code
 ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
 RUN chmod +x /wait
 
+RUN apt update && apt install curl -y
+
 EXPOSE 8000
+HEALTHCHECK --interval=30s --timeout=30s --retries=5 --start-period=5s CMD curl -f http://0.0.0.0:8000 || exit 1
+
+CMD uvicorn main:app --reload --host 0.0.0.0 --port $FASTAPI_PORT
 
-CMD /wait && uvicorn main:app --reload --host 0.0.0.0 --port 8000