The Next.js app does not work well after creating the image

  docker, dockerfile, next.js, node.js

I have a problem after creating a docker image.

If I build applications without Docker (npm run build, npm start), everything works correctly. Screenshots below.

Please suggest how to fix the problem

Dockerfile:

FROM node:alpine

RUN apk add --no-cache libc6-compat

RUN mkdir /brahhouse

WORKDIR /brahhouse

COPY ./package*.json /brahhouse

RUN npm install

COPY . /brahhouse

RUN npm run build

CMD ["npm", "start"]

I build docker image with command:

docker build -t brahouse .

I run docker image with command:

docker run -p 3000:3000 brahouse

Screenshots:

App without Docker

App in Docker Images

Source: Docker Questions

LEAVE A COMMENT