Postgres Shutdown Immediately after docker compose up?
Add a link between your web and postgres image like so:
version: '2'services: postgres: restart: always image: sameersbn/postgresql:9.6-2 ports: - "5432:5432" environment: - DB_USER=shorturl - DB_PASS=shorturl - DB_NAME=shorturl web: build: . ports: - "4000:4000" volumes: - .:/shortlr depends_on: - postgres links: - postgres command: ["./wait-for-it.sh","postgres:5432", "--", "npm", "start"]
Although you should use networks instead because links is a legacy option. Read the docs on networks here