Skip to content

Next 9 will not build in Docker  #7938

@CoachThomLamb

Description

@CoachThomLamb

Bug report

This is my code. It's a hello world app with Next 9.0.1

Does not work in docker.

docker build -t cgcweb .

Describe the bug

Next 9 does not work in Docker.

To Reproduce

Here is my repo: https://github.com/WillowHQ/dockerIssue

yarn
yarn run build
yarn run start
Works as expected.

docker build -t cgcweb .
Sending build context to Docker daemon 1.076MB
Step 1/9 : FROM node:8.9.4
---> 672002a50a0b
Step 2/9 : COPY . .
---> 930ba71436a7
Step 3/9 : RUN rm -rf node_modules
---> Running in 6a02f97d7e04
Removing intermediate container 6a02f97d7e04
---> 417bb64d94c6
Step 4/9 : RUN rm -rf .next
---> Running in fb08b231ad4c
Removing intermediate container fb08b231ad4c
---> 21565ed63d03
Step 5/9 : RUN rm yarn.lock
---> Running in 262dd1b4f4a6
Removing intermediate container 262dd1b4f4a6
---> d4397a346e97
Step 6/9 : RUN yarn install
---> Running in b7432590fedd
yarn install v1.3.2
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 14.75s.
Removing intermediate container b7432590fedd
---> 1f5bc4dd889f
Step 7/9 : RUN yarn run build
---> Running in 4df33457b0f6
yarn run v1.3.2
warning package.json: No license field
$ next build

Build error occurred
{ Error: ENOENT: no such file or directory, stat '/dev/fd/10' errno: -2, code: 'ENOENT', syscall: 'stat', path: '/dev/fd/10' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn run build' returned a non-zero code: 1

  1. Click on '....'
  2. Scroll down to '....'
  3. See error

docker run -p 3000:3000 -it cgcweb

Expected behavior

A clear and concise description of what you expected to happen.
I'd expect Next to work in Docker.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: MacOS
  • Node 8.9.4 and 10.13
  • Version of Next.js: [9.0.1]

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions