ASP.NET 5.0测试版8泊坞窗未启动 [英] ASP.NET 5.0 beta 8 in Docker doesn't start
问题描述
我已经运行在一个码头工人容器使用ASP.NET 5.0测试版7一个网站,使用官方泊坞窗图像 - 的 https://github.com/aspnet/aspnet-docker - 这是工作的罚款
我最近更新我的项目测试版8,并改变了Dockerfile使用beta版本8泊坞窗形象。一切工作正常,当我在我的Windows计算机上本地运行它,我是否使用Visual Studio开始与IIS防爆preSS项目,或者使用红隼运行它。
不过,后来我把它推到我的Dokku服务器时,它似乎并没有正常启动。我不明白从容器中输出的任何错误,但我有Dokku用来确保Web服务器已经开始了检查文件和失败(表明它已经无法正常启动,或不听,因为它应该是) 。我试图消除了检查,我无法连接到它要么 - 我从nginx的一个坏消息网关
。我不知道为什么会这样,因为当我推到Dokku,我得到以下响应:
...
遥控器:1G ----->尝试5/5等待10秒... [K
遥控器:1G CHECKS预期的结果:[K
遥控器:[1G的http://本地主机/ = GT; 我的网站[K遥控器:无法启动,由于1失败的检查[K。
遥控器:1G! [K
遥控器:[1Gcurl:(7)无法连接到172.17.2.14端口5000:连接被拒绝[K
遥控器:1G!检查试图5/5不合格。[K
遥控器:1G =====> mywebsite容器输出:[K
遥控器:[1G信息:[Microsoft.Framework.DependencyInjection.DataProtectionServices]用户配置文件是可用的。使用/root/.local/share/ASP.NET/DataProtection-Keys'作为密钥存储库;密钥不会在休息加密。[K遥控器:1G的托管环境:生产[K
遥控器:1G现在监听:HTTP://本地主机:5000 [K
遥控器:1G应用开始。 preSS Ctrl + C键关机。[K
遥控器:1G =====>结束mywebsite容器输出[K`
...
这似乎很奇怪,因为它看起来像它已经开始,但经过检查都失败了。正如我所说的,消除了检查,意味着它成功部署但我无法连接到它。
我的Dockerfile是:
微软/ ASPNET:1.0.0-beta8#安装NPM
运行apt-get更新和放大器;&安培;易于得到安装-y卷曲
RUN卷曲-SL https://deb.nodesource.com/setup |庆典 -
运行apt-get安装的NodeJS -y#安装咕嘟咕嘟
RUN NPM安装-g一饮而尽COPY。 /应用
WORKDIR /应用
RUN [DNU,恢复]WORKDIR ./src/mywebsiteRUN [故宫,安装]
RUN [一饮而尽,分]EXPOSE 5000
入口点DNX红隼
我遇到了类似的问题,我无法访问我的ASP.NET 5测试版网站8在Windows泊坞窗容器中运行,我得到同样的消息作为你。
我不知道这是否是同样的问题你,但这里就是我如何固定它在我结束。症状看起来类似。该问题涉及到这条线的位置:
现在监听:HTTP://本地主机:5000
有趣的是,当我做了一个泊坞窗PS
这表明该端口5000是被转发 0.0.0.0
,而不是本地主机
。
解决方案
我解决了这个问题的方法是在 project.json
更新我的网站
命令指定实际的网络接口使用方法:
命令:{
网络:Microsoft.AspNet.Server.Kestrel --server.urls http://0.0.0.0:5000
EF:EntityFramework.Commands
},
在我这样做,我看得出来,红隼,现在正在听的是码头工人转发给我相同的接口上,我能够访问该网站没有任何问题。
替代使用Dockerfile
您也可以只是在你的 Dockerfile
更新入口点
命令
入口点[DNX,网络,--server.urls,http://0.0.0.0:5000]
(你要替换 0.0.0.0
与码头工人被暴露的确切接口)。
博客文章/本文作者
如果您想了解更多关于这个(或如何使用ASP.NET 5在Windows上运行多克),来看看我的博客新手必看这里:<一href=\"http://dotnetliberty.com/index.php/2015/10/25/asp-net-5-running-in-docker-on-windows/\">http://dotnetliberty.com/index.php/2015/10/25/asp-net-5-running-in-docker-on-windows/
I have been running a website using ASP.NET 5.0 beta 7 in a Docker container, using the official Docker image - https://github.com/aspnet/aspnet-docker - which was working fine.
I recently updated my project to beta 8, and changed the Dockerfile to use the beta 8 version of the Docker image. Everything works fine when I run it locally on my Windows machine, whether I use Visual Studio to start the project with IIS Express, or run it using Kestrel.
However, then I push it to my Dokku server, it doesn't seem to start properly. I don't get any errors from the container output, but I have a CHECKS file which Dokku uses to ensure the web server has started, and this fails (indicating it hasn't started properly, or is not listening as it should be). I tried removing the CHECKS and I cannot connect to it either - I get a bad gateway message from nginx.
I don't know why this is happening, because when I push to Dokku, I get the following response:
...
remote: [1G-----> Attempt 5/5 Waiting for 10 seconds ...[K
remote: [1G CHECKS expected result:[K
remote: [1G http://localhost/ => "My Website"[K
remote: Could not start due to 1 failed checks.[K
remote: [1G ! [K
remote: [1Gcurl: (7) Failed to connect to 172.17.2.14 port 5000: Connection refused[K
remote: [1G ! Check attempt 5/5 failed.[K
remote: [1G=====> mywebsite container output:[K
remote: [1G info : [Microsoft.Framework.DependencyInjection.DataProtectionServices] User profile is available. Using '/root/.local/share/ASP.NET/DataProtection-Keys' as key repository; keys will not be encrypted at rest.[K
remote: [1G Hosting environment: Production[K
remote: [1G Now listening on: http://localhost:5000[K
remote: [1G Application started. Press Ctrl+C to shut down.[K
remote: [1G=====> end mywebsite container output[K`
...
This seems odd because it looks like it is starting, but after the checks have failed. As I said, removing the checks means it deploys successfully but then I'm unable to connect to it.
My Dockerfile is:
FROM microsoft/aspnet:1.0.0-beta8
# Install NPM
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
# Install Gulp
RUN npm install -g gulp
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
WORKDIR ./src/mywebsite
RUN ["npm", "install"]
RUN ["gulp", "min"]
EXPOSE 5000
ENTRYPOINT dnx kestrel
I ran into a similar issue where I couldn't access my ASP.NET 5 beta 8 website running in a Docker container on Windows, I was getting the same message as you.
I'm not sure if this will be the same issue for you, but here's how I fixed it on my end. The symptoms looks similar. The issue was related to this line here:
Now listening on: http://localhost:5000
The interesting thing is when I did a docker ps
it showed that port 5000 was being forwarded on 0.0.0.0
, not localhost
.
The Solution
The way I fixed this was to update my web
command in project.json
to specify the actual network interface to use:
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://0.0.0.0:5000",
"ef": "EntityFramework.Commands"
},
Once I did this, I could see that Kestrel was now listening on the same interface that Docker was forwarding for me and I was able to access the website without any problems.
Alternative using Dockerfile
You can also just update your ENTRYPOINT
command in your Dockerfile
:
ENTRYPOINT ["dnx", "web", "--server.urls", "http://0.0.0.0:5000"]
(You'll want to replace 0.0.0.0
with the exact interface that Docker is exposing).
Blog Post / Writeup
If you want to read more about this (or how to run Docker on Windows with ASP.NET 5), take a look at my blog writeup here: http://dotnetliberty.com/index.php/2015/10/25/asp-net-5-running-in-docker-on-windows/
这篇关于ASP.NET 5.0测试版8泊坞窗未启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!