Building a node image: Error response from daemon: dockerfile parse error line 15: unknown instruction: CMD["NODE",

I am trying to build a docker image for an app that uses yarn dependencies. I have this error when I run

docker build . -t [name]

It starts building, but then I get this error.

Error response from daemon: dockerfile parse error line 15: unknown instruction: CMD["NODE",

This is my dockerfile

FROM node

WORKDIR /usr/src/app

RUN npm install

COPY package*.json ./
COPY . .

RUN npm install --global yarn
RUN yarn install

EXPOSE 3002

CMD["node", "app.js"]
CMD["yarn", "start"]

What am I doing wrong?

I tried changing the Dockerfile lines. Is there a different way for building yarn apps?

>Solution :

Change:

CMD["node", "app.js"]
CMD["yarn", "start"]

in

CMD ["node", "app.js"]
CMD ["yarn", "start"]

You missed the space between CMD and [.

Leave a Reply