-
Notifications
You must be signed in to change notification settings - Fork 169
Container exits after starting / Sample docker file #58
Comments
Just managed to get some logs although it didn't last an hour this time. This was with -t in the Docker options so it just seems to make it last a little longer:
As you can see, you just end up with "Requesting shutdown." from somewhere. |
So you had
And sleep was keeping the dnx awake (because otherwise kestrel server waits for keyboard input and just dies within seconds). Your server died precisely 1000 seconds later. So if you do
It will live much longer. Keyboard requirement is a known problem and will be fixed in the next release: aspnet/Hosting#255 |
Thanks Ahmet, I didn't know that was a currently outstanding issue and wasn't sure exactly what the sleep was for. |
Does this solve your problem for now? |
Finally we get rid of the nasty |
😄 |
I've just pushed up a build with that, will report back once it has been up for a while. Update: Seems to be working do far. 👍 |
I've been trying to get this to work with a standard empty project from the Visual Studio ASP.Net 5 templates. This template generates the following kind of structure: (I also added the kestrel command and dependency to the project.json file as this isn't there by default - Here's what I've ended up with: https://github.com/yngndrw/ASPNetTest)
There wasn't an example Dockerfile on here that I could find so the first Dockerfile example that I saw from a blog was:
I changed the project path and this deployed the whole solution only to find the container was exiting right after it started. It looks like the following command is used to start the container:
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
In this case, $port is "5000", $DOCKER_ARGS and $STARG_CMD are both empty and $IMAGE is an image built from my repository.
The main point of interest is -d meaning that it will be running as a background process. If I add -t, the container doesn't automatically shut down but I'm unsure as to why it helps. It also seems like a strange configuration, I thought -t would normally only be combined with -i.
I then found a different example in an old issue on here and tried the following:
This with the standard docker options (I.e. without -t) allowed my container to run for a while, but it exited after approximately an hour. Sadly I forgot to check the logs but will do when I next get a chance to.
Can anybody recommend a good Dockerfile setup to use ?
The text was updated successfully, but these errors were encountered: