Matheus Genteluci
Matheus Genteluci

Reputation: 96

Unexpected token in docker logs after docker run

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

Upvotes: 4

Views: 16017

Answers (1)

DazWilkin
DazWilkin

Reputation: 40261

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

Upvotes: 10

Related Questions