ebcli
如何发出docker
运行命令似乎有些问题。
以下是我在MacOS机器上运行的命令
eb local run --port 3001
虽然eb
能够成功构建docker映像,但是当它尝试运行docker映像时,它会在下面抛出错误。
docker: invalid publish opts format (should be name=value but got '3001:${PORT}').
以下是我的Dockerfile的外观
# Check out https://hub.docker.com/_/node to select a new base image
FROM node:10-slim
# Set to a non-root built-in user `node`
USER node
# Create app directory (with user `node`)
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY --chown=node package*.json ./
RUN npm install
# Bundle app source code
COPY --chown=node . .
RUN npm run build
# Bind to all network interfaces so that it can be mapped to the host OS
ENV HOST=0.0.0.0 PORT=3000
EXPOSE ${PORT}
CMD [ "node", "." ]
这是ebcli
的限制。发生这种情况的原因是ebcli
解析您的dockerfile来检索公开的端口。因为您在EXPOSE指令中引用环境变量,所以ebcli会将其读取为文字字符串,并尝试将端口选项分配给-p 3001:${PORT}
。
要解决此问题,您将需要修改EXPOSE指令以显式公开值3000。
示例:
EXPOSE 3000
随时在ebcli github repository上报告此。