intermediateSpring Boot Integration: Dockerizing, PostgreSQL, Redis, Kafka & Microservices

Order service crash-loops on startup only in Docker Compose, never when run locally from the IDE

The Spring Boot app connects fine to Postgres when run from IntelliJ against a container started separately, but crash-loops with connection refused when the whole stack is started together via docker compose up. Diagnose. Expected reasoning: when run from the IDE, the developer likely has the connection string pointed at localhost:5432 (a port-mapped container), which is valid in that specific context. Inside Compose, the app container itself needs to resolve the database by service name (db), not localhost, since the app and database are now both containers on the same project network with n

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

Order service crash-loops on startup only in Docker Compose, never when run locally from the IDE

Next Step

Continue to Kafka consumers in one service never receive messages produced by another service← Back to all Docker questions