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
ENTRYPOINT dnx kestrel --server.urls http://0.0.0.0:5000
worked, thanks! – Marjoram