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']
使用此命令运行此操作
docker run --rm -p 3000:3000 my-app:latest
控制台输出
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.
我希望/usr/local/bin/yarn run dev
在docker中执行,我错过了什么吗?
答案 0 :(得分:5)
尝试切换到双引号,单引号对json字符串无效:
CMD ["dev"]