user469652 user469652 - 2 days ago 4
Node.js Question

docker: Command "/bin/sh" not found

ENV PORT=3000
ENV NODE_ENV=production
EXPOSE $PORT

WORKDIR $APP_DIR
COPY yarn.lock package.json $APP_DIR/
RUN ["/usr/local/bin/yarn"]

COPY . $APP_DIR
ENTRYPOINT ["/usr/local/bin/yarn", "run"]
CMD ['dev']


Was running this using this command

docker run --rm -p 3000:3000 my-app:latest


And the console outputs

yarn run v0.17.9
error Command "/bin/sh" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


I expect
/usr/local/bin/yarn run dev
to be executed inside docker, am I missing something?

Answer

Try switching to double quotes, single quotes aren't valid for a json string:

CMD ["dev"]
Comments