I've got a very simple project express app. I've dockerized the app but Im having issues running the docker run
command.
I keep on seeing this error when I run docker run test -p 8080:3000
docker run test -p 8080:3000
[eval]:1
8080:3000
^
SyntaxError: Unexpected token ':'
at new Script (vm.js:99:7)
at createScript (vm.js:249:10)
at Object.runInThisContext (vm.js:297:10)
at Object.<anonymous> ([eval]-wrapper:10:26)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at evalScript (internal/process/execution.js:94:25)
at internal/main/eval_string.js:23:3
my dockerfile looks llike this:
FROM node:alpine
RUN apk update && apk add python make g++
WORKDIR /app
COPY ./package.json ./
RUN npm install
COPY ./ ./
CMD ["npm", "run", "dev"]
If I run docker run imageName
, it's fine the container starts. But because I don't have port mapping I cant make use of the app.
What am I doing wrong?
The issue is with the command Im running. Instead of running docker run test -p 8080:3000
it should have been docker run -p 8080:3000 test
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.