ASP.NET 5.0 beta 8 in Docker doesn't start -
i have been running website using asp.net 5.0 beta 7 in docker container, using official docker image - https://github.com/aspnet/aspnet-docker - working fine.
i updated project beta 8, , changed dockerfile use beta 8 version of docker image. works fine when run locally on windows machine, whether use visual studio start project iis express, or run using kestrel.
however, push dokku server, doesn't seem start properly. don't errors container output, have checks file dokku uses ensure web server has started, , fails (indicating hasn't started properly, or not listening should be). tried removing checks , cannot connect either - bad gateway message nginx.
i don't know why happening, because when push dokku, following response:
... remote: [1g-----> attempt 5/5 waiting 10 seconds ...[k remote: [1g checks expected result:[k remote: [1g http://localhost/ => "my website"[k remote: not start due 1 failed checks.[k remote: [1g ! [k remote: [1gcurl: (7) failed connect 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 available. using '/root/.local/share/asp.net/dataprotection-keys' key repository; keys not encrypted @ rest.[k remote: [1g hosting environment: production[k remote: [1g listening on: http://localhost:5000[k remote: [1g application started. press ctrl+c shut down.[k remote: [1g=====> end mywebsite container output[k` ...
this seems odd because looks starting, after checks have failed. said, removing checks means deploys i'm unable connect 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 similar issue couldn't access asp.net 5 beta 8 website running in docker container on windows, getting same message you.
i'm not sure if same issue you, here's how fixed on end. symptoms looks similar. issue related line here:
now listening on: http://localhost:5000
the interesting thing when did docker ps
showed port 5000 being forwarded on 0.0.0.0
, not localhost
.
the solution
the way fixed update web
command in project.json
specify actual network interface use:
"commands": { "web": "microsoft.aspnet.server.kestrel --server.urls http://0.0.0.0:5000", "ef": "entityframework.commands" },
once did this, see kestrel listening on same interface docker forwarding me , able access website without problems.
alternative using dockerfile
you can update entrypoint
command in dockerfile
:
entrypoint ["dnx", "web", "--server.urls", "http://0.0.0.0:5000"]
(you'll want replace 0.0.0.0
exact interface docker exposing).
blog post / writeup
if want read more (or how run docker on windows asp.net 5), take @ blog writeup here: http://dotnetliberty.com/index.php/2015/10/25/asp-net-5-running-in-docker-on-windows/
Comments
Post a Comment