SSG DB access with Docker build #36475
-
|
I'm trying to "Dockerize" my Next.js app and running into a problem. Possibly/probably of my own doing, but still. I have a Dockerized Postgres image to run my database. That is up and running, but when I try to build my app via Docker (via I've tried using FWIW I'm using a lightly modified version of https://github.com/vercel/next.js/tree/canary/examples/with-docker thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
Classic rubber duck posting, but in case someone else is searching: The issue I had was that I was adding services:
web:
# network listed on service:web
network: host
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
build:
context: .
dockerfile: ./packages/web/Dockerfile
volumes:
- .:/app
ports:
- 3000:3000
- 5432:5432
- 6379:6379This did: services:
web:
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
build:
context: .
# network listed on service:web:build
network: host
dockerfile: ./packages/web/Dockerfile
volumes:
- .:/app
ports:
- 3000:3000
- 5432:5432
- 6379:6379 |
Beta Was this translation helpful? Give feedback.
-
|
I have been searching for this for about 25 days. |
Beta Was this translation helpful? Give feedback.
-
|
For those still struggling to get this working, the db connection string cannot be As far as I understand it, the |
Beta Was this translation helpful? Give feedback.
Classic rubber duck posting, but in case someone else is searching:
The issue I had was that I was adding
network: hostto the service, but not build. So while this didn't work:This did: