【发布时间】:2016-03-16 16:40:54
【问题描述】:
我正在尝试通过 elasticbeanstalk 将 Docker 容器中的 .net asp web api 应用程序部署到亚马逊,但这是我得到的:
ERROR: Failed to start nginx, abort deployment
ERROR: [Instance: i-ecf0d365] Command failed on instance. Return code: 1 Output: nginx: [emerg] invalid host in upstream "172.17.0.2:5000/tcp" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
图片在这里:https://hub.docker.com/r/wedkarz/awsm8-api/
Dockerfile
FROM microsoft/aspnet:latest
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "web"]
elasticbeanstalk-nginx-docker-upstream.conf 文件
upstream docker {
server 172.17.0.2:5000/tcp;
keepalive 256;
}
【问题讨论】:
-
错误消息表明您的
nginx配置文件中有一个虚假的/tcp,在upstream server指令或xxx_pass指令上。 -
我用 conf 文件更新了问题?这个 nginx 配置是从哪里来的?它是否包含在 aspnet 图像中?还是码头工人出于某种原因放这个?
-
我不知道,但它似乎使用了
5000/tcp作为端口,而不是正确的值应该是5000。 -
@RichardSmith 你是对的!我将 Dockerfile 更改为 EXPOSE 5000,现在它可以工作了 :)
-
@RichardSmith 不错。你能把这个作为正式答案提交吗?
标签: asp.net amazon-web-services nginx docker amazon-elastic-beanstalk