Amazon web services AWS Elastic Beanstalk和Docker-EXPOSE至少需要一个参数
在过去的几天里,我一直试图将我的docker映像部署到AWS beanstalk,但遇到了这个问题,我找不到解决方案。当我(通过控制台)将dockrun.aws.json文件上载到我的环境时,它会抛出此错误Amazon web services AWS Elastic Beanstalk和Docker-EXPOSE至少需要一个参数,amazon-web-services,docker,
elasticsearch,amazon-elastic-beanstalk,dockerfile,Amazon Web Services,Docker,
elasticsearch,Amazon Elastic Beanstalk,Dockerfile,在过去的几天里,我一直试图将我的docker映像部署到AWS beanstalk,但遇到了这个问题,我找不到解决方案。当我(通过控制台)将dockrun.aws.json文件上载到我的环境时,它会抛出此错误 Failed to build Docker image aws_beanstalk/staging-app: Sending build context to Docker daemon 3.072kB Error response from daemon: Dockerfile pars
Failed to build Docker image aws_beanstalk/staging-app: Sending build context to Docker daemon 3.072kB Error response from daemon: Dockerfile parse error line 2: EXPOSE requires at least one argument. Check snapshot logs for details.
奇怪的是,在我的Dockerfile中,我的EXPOSE关键字包含端口80作为参数
Dockerfile:
FROM ubuntu
EXPOSE 80
ADD application.py /application.py
ADD requirements.txt /requirements.txt
RUN apt-get update
RUN apt-get -y install sudo
RUN sudo apt-get -y install python3-pip
# INSTALLING GCC
# RUN sudo apt-get -y install gcc
# DEPENDENCY INSTALATION
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install -r ./requirements.txt
# SPACY ENGLISH MODEL DOWNLOAD
RUN python3 -m spacy download en
CMD ["python3", "./application.py"]
dockrun.aws.json:
{
"AWSEBDockerrunVersion": "1",
"Image" : {
"Name" : "guppythegod/racheal_entrance_gateway:latest",
"Update" : "true"
},
"Ports" : {
"ContainerPort" : "80"
}
}
以下是我在Docker hub上的图片链接:
我的所有权限都有效,并且保存我的映像的存储库是公共的。如果有人能帮助我,我将不胜感激
谢谢。
端口应该是一个数组,如下所示:
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "guppythegod/racheal_entrance_gateway:latest",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "80"
}
]
}
端口
应该是一个数组,如下所示:
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "guppythegod/racheal_entrance_gateway:latest",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "80"
}
]
}
设置ENV端口号解决了我的问题,还有一个技巧是在部署之前提交更改eb deploy
DockerFile
FROM node:alpine AS builder
WORKDIR /opt/app
COPY package.json ./
RUN npm install
COPY . /opt/app
RUN npm run build
FROM nginx
COPY --from=builder /opt/app/build /usr/share/nginx/html
ENV PORT 80
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
设置ENV端口号解决了我的问题,还有一个技巧是在部署之前提交更改eb deploy
DockerFile
FROM node:alpine AS builder
WORKDIR /opt/app
COPY package.json ./
RUN npm install
COPY . /opt/app
RUN npm run build
FROM nginx
COPY --from=builder /opt/app/build /usr/share/nginx/html
ENV PORT 80
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
这个答案拯救了我们的团队。这个答案拯救了我们的团队。