docker-node
docker-node copied to clipboard
Dockerfile FROM node:18-alpine as nodebuilder error
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
Not sure if it's a typo but you are missing the dash before 'it'. It should be docker run -it
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 '-'.
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