Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile FROM node:18-alpine as nodebuilder error #2005

Open
gaoJava opened this issue Dec 5, 2023 · 3 comments
Open

Dockerfile FROM node:18-alpine as nodebuilder error #2005

gaoJava opened this issue Dec 5, 2023 · 3 comments

Comments

@gaoJava
Copy link

gaoJava commented Dec 5, 2023

Environment

  • Platform: centons7 x86_64
  • Docker Version: Docker version 20.10.16
  • Node.js Version: node:18-alpine
  • Image Tag:

Expected Behavior

When I use FROM node:18-alpine in my Dockerfile, and after completion, when I run the docker run -it command, I encounter the error: 'Error: Cannot find module '/web/bash'.

error:

node:internal/modules/cjs/loader:1137
  throw err;
  ^

Error: Cannot find module '/web/bash'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
    at Module._load (node:internal/modules/cjs/loader:975:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.19.0

Current Behavior

Possible Solution

Steps to Reproduce

1)docker build -f Dockerfile -t vesoft/nebula-studio:test1 .
2)docker run -it vesoft/nebula-studio:test1 bash

Dockerfile content:

FROM node:18-alpine as nodebuilder
LABEL stage=nodebuilder
WORKDIR /web
COPY package.json /web/
COPY .npmrc /web/
RUN npm cache clear --force

Additional Information

@LaurentGoderre
Copy link
Member

Not sure if it's a typo but you are missing the dash before 'it'. It should be docker run -it

@gaoJava
Copy link
Author

gaoJava commented Dec 7, 2023

Not sure if it's a typo but you are missing the dash before 'it'. It should be docker run -it

Sorry, I missed a '-'.

@LaurentGoderre
Copy link
Member

Sorry it didn't occur to me sooner. The entrypoint tries to see if the first argument is an executable. If it isn't it assumes it's a node script.

Alpine doesn't have bash by default, it only has sh. So this should work docker run -it vesoft/nebula-studio:test1 bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants