在过去的几天中,我一直在尝试将docker镜像部署到AWS Beanstalk,但遇到了我找不到解决方案的问题。当我将Dockerrun.aws.json文件上传到我的环境(通过控制台)时,它会引发此错误

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"]

Dockerrun.aws.json:
 {
     "AWSEBDockerrunVersion": "1",
     "Image" : {
      "Name" : "guppythegod/racheal_entrance_gateway:latest",
       "Update" : "true"
     },
     "Ports" : {
       "ContainerPort" : "80"
     }
 }

这是我在Docker集线器上的镜像的链接:
https://hub.docker.com/r/guppythegod/racheal_entrance_gateway

我所有的权限都在起作用,保存我的图像的存储库是公共(public)的。如果有人可以帮助我,将不胜感激。

谢谢。

最佳答案

Ports应该是一个数组,如下所示:

{
  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "guppythegod/racheal_entrance_gateway:latest",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "80"
    }
  ]
}

关于amazon-web-services - AWS Elastic Beanstalk和Docker-EXPOSE至少需要一个参数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49722613/

10-16 09:27