错误:在Dockerfile中找不到EXPOSE指令,中止部署+ AWS + RAILS + DOCKER

我通过Docker将代码部署到AWS EC2时出现错误,我对Docker和AWS(首次部署)非常新,下面是我的configuration文件。

Dockerrun.aws.json

{ "AWSEBDockerrunVersion": 2, "volumes": [ { "name": "run_folder", "host": { "sourcePath": "/home/ravindra.yadav/run" } }, { "name": "assets_folder", "host": { "sourcePath": "/home/ravindra.yadav/assets" } }, { "name": "log_folder", "host": { "sourcePath": "/home/ravindra.yadav/log" } } ], "containerDefinitions": [ { "name": "postgres", "image": "postgres:9.5.1", "essential": true, "mountPoints": [ { "sourceVolume": "run_folder", "containerPath": "/var/run" }, { "sourceVolume": "assets_folder", "containerPath": "/var/www" }, { "sourceVolume": "log_folder", "containerPath": "/var/log" } ] }, { "name": "proxy", "image": "nginx:latest", "essential": true, "memory": 500, "portMappings": [ { "hostPort": 80, "containerPort": 80 } ], "mountPoints": [ { "sourceVolume": "run_folder", "containerPath": "/var/run" }, { "sourceVolume": "assets_folder", "containerPath": "/var/www" }, { "sourceVolume": "log_folder", "containerPath": "/var/log" } ] }, { "name": "cluetap_api", "image": "ravindra9278/cluetap_api:v1", "essential": true, "mountPoints": [ { "sourceVolume": "run_folder", "containerPath": "/var/run" }, { "sourceVolume": "assets_folder", "containerPath": "/var/www" }, { "sourceVolume": "log_folder", "containerPath": "/app/log" } ], "environment": [ { "name": "RAILS_SERVE_STATIC_FILES", "value": "false" }, { "name": "RAILS_ENV", "value": "production" }, { "name": "REL_DATABASE_HOST", "value": "db" }, { "name": "REL_DATABASE_PORT", "value": "5432" }, { "name": "REL_DATABASE_USERNAME", "value": "postgres" }, { "name": "REL_DATABASE_DATABASE", "value": "cluetap_development" }, { "name": "REL_DATABASE_PASSWORD", "value": "" } ] } ] } 

下面是我的Dockerfileconfiguration:

 FROM ruby:2.3.1 RUN useradd -ms /bin/bash web RUN apt-get update -qq && apt-get install -y build-essential RUN apt-get -y install nginx RUN apt-get -y install sudo # for postgres RUN apt-get install -y libpq-dev # for nokogiri RUN apt-get install -y libxml2-dev libxslt1-dev # for a JS runtime RUN apt-get install -y nodejs RUN apt-get update # For docker cache WORKDIR /tmp ADD ./Gemfile Gemfile ADD ./Gemfile.lock Gemfile.lock ENV BUNDLE_PATH /bundle RUN gem install bundler --no-rdoc --no-ri RUN bundle install # END ENV APP_HOME /home/web/cluetap_app RUN mkdir -p $APP_HOME WORKDIR $APP_HOME ADD . $APP_HOME RUN chown -R web:web $APP_HOME ADD ./nginx/nginx.conf /etc/nginx/ RUN unlink /etc/nginx/sites-enabled/default ADD ./nginx/cluetap_nginx.conf /etc/nginx/sites-available/ RUN ln -s /etc/nginx/sites-available/cluetap_nginx.conf /etc/nginx/sites-enabled/cluetap_nginx.conf RUN usermod -a -G sudo web 

在我的本地系统映像构build正确,它的运行正常,但在部署时它不工作,并ERROR: No EXPOSE directive found in Dockerfile, abort deployment错误ERROR: No EXPOSE directive found in Dockerfile, abort deployment

我使用数据库作为Postgres和服务器作为Nginx。