3000
. Go to http://localhost:3000 to see your app. The
dev server supports hot reloading, so it reloads the application when you make changes.
.next
directory.
npm run start
to start a local production server.nextjs-app
image for the platform linux/amd64
and tags it as latest
.
If you are locally testing your application, you can skip the platform
key to build the images.
-it
: enables interactivity with TTY.--rm
: tells the Docker Daemon to clean up the container and remove the file system after the container exits.--name nextjs-app
: Name of the container nextjs-app
.-e PORT=3000
: Sets the environment variable PORT in Docker to 3000
.-d
: Runs the container in detached (background) mode. You can skip the flag to see the logs directly in your
terminal window.-p 3000:3000
: Maps port 3000 on your host to port 3000 in the container.nextjs-app
at the end is the name of the image.http://localhost:3000
to see the Next.js application running inside the Docker
container.
Hurray π. Now we have created and packaged a Next.js app for production use.
with-docker
example, which is an official example published by the Next.js team.