I am trying to run my app which depends_on
my Postgresql in Docker
let say my database PostgreSQL not running now
and in my docker-compose.yml
:
version: "3"
services:
myapp:
depends_on:
- db
container_name: myapp
build:
context: .
dockerfile: Dockerfile
restart: on-failure
ports:
- "8100:8100"
db:
container_name: postgres
restart: on-failure
image: postgres:10-alpine
ports:
- "5555:5432"
environment:
POSTGRES_USER: myuser
POSTGRES_PASSWORD: 12345678
POSTGRES_DB: dev
when I try docker-compose up -d
yes it created the postgres
and then create that myapp
service
but it seems my Postgresql is not running yet, after finish install and running myapp
,
it said:
my database server not running yet
how to make myapp
running until that db
service know that my db
running ??