Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected token in docker logs after docker run

Tags:

docker

After running:

docker run -d nodeapi -p 49160:3000

The container doesnt start and when I look at docker logs I see the error:

[eval]:1
49160:3000

SyntaxError: Unexpected token :

Here's my Dockerfile:

FROM node:10

WORKDIR /usr/app

COPY package.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]

edit: I'm running that on Windows 10 via Docker Toolbox

like image 233
Matheus Genteluci Avatar asked Oct 15 '25 05:10

Matheus Genteluci


1 Answers

The -p 49160:3000 needs to be before the container image nodeapi. The way you have it, -p 49160:3000 is passed to the container's npm start as if it were command-line flags|params. Clearly, it doesn't like the colon.

So.

docker run --detach --publish 49160:3000 nodeapi 

While you debug, it may be preferable to run the container interactively:

docker run --interactive --tty --publish=49160:3000 nodeapi
like image 81
DazWilkin Avatar answered Oct 17 '25 20:10

DazWilkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!