How to deploy Nextjs with-docker example on Fly.io?

I’m trying to test out NextJs on Fly and using Vercel’s with-docker example.

However, I keep getting errors after deployment and the automatic fly site doesn’t work.

2022-02-03T02:04:51.230 runner[d7817843] sin [info] Starting instance

2022-02-03T02:04:51.258 runner[d7817843] sin [info] Configuring virtual machine

2022-02-03T02:04:51.259 runner[d7817843] sin [info] Pulling container image

2022-02-03T02:04:56.392 runner[d7817843] sin [info] Unpacking image

2022-02-03T02:04:56.884 runner[d7817843] sin [info] Preparing kernel init

2022-02-03T02:04:57.282 runner[d7817843] sin [info] Configuring firecracker

2022-02-03T02:05:02.337 runner[d7817843] sin [info] Starting virtual machine

2022-02-03T02:05:02.484 app[d7817843] sin [info] Starting init (commit: 0c50bff)…

2022-02-03T02:05:02.500 app[d7817843] sin [info] Preparing to run: docker-entrypoint.sh node server.js as nextjs

2022-02-03T02:05:02.508 app[d7817843] sin [info] 2022/02/03 02:05:02 listening on [fdaa:0:49ae:a7b:232f:d781:7843:2]:22 (DNS: [fdaa::3]:53)

2022-02-03T02:05:02.839 app[d7817843] sin [info] Listening on port 3000

2022-02-03T02:05:40.567 proxy[d7817843] sin [error] Health check status changed ‘passing’ => ‘critical’

Has anyone managed to get NextJS docker working on fly.io? It seems seriously more difficult than I anticipated.

The server looks to be listening on port 3000. Try setting internal_port = 3000 in your `fly.toml’.

1 Like

Looks like that was the problem. Need to bear in mind docker/fly.toml stuff when using this service I suppose.

If only it was like Heroku, where I could just push something then it’ll package things accordingly. That would be the dream.

1 Like

We’re working on it!

1 Like