Forum Discussion
LouisT
Dec 04, 2025Copper Contributor
Container on App Service keeps getting stopped and terminated
I've got a .Net app running in a Docker container that I'm trying to run on a Linux App Service but as per the (sanitised) log output below from the Platform log stream, it's getting terminated only ...
rogerval
Dec 05, 2025MCT
When a custom container on Linux App Service terminates only a few seconds after start and the log shows:
Container is running.
Container start method finished…
Container is terminating. Grace period: 0 seconds.
it usually means the entrypoint process exited, even if the platform briefly reports “running.”
Key causes to check:
- Your container’s main process is stopping immediately
App Service requires the entrypoint to stay alive. If your .NET app runs, prints logs, and then exits (for example, missing a web server binding), the container is deleted instantly. - The app is not listening on the required port
Linux App Service expects the app to listen on port 8080 (or the port defined in WEBSITES_PORT).
If the container listens on 5000/80/etc. without exposing 8080, the health probe fails and App Service stops the container. - No “long-running” foreground process
If the app launches and then returns control to the shell (for example, backgrounding the process), App Service treats it like a completed job and terminates it. - Dockerfile CMD/ENTRYPOINT mismatch
A misconfigured Dockerfile can cause the runtime to exit instantly:
- ENTRYPOINT overwritten by App Service
- Using CMD ["dotnet", "myapp.dll"] but the DLL is missing or misnamed
- Health probes not compatible with the container path
Recommended steps:
- Check container logs in Log Stream → Container Logs.
- Ensure your app listens on the same port as WEBSITES_PORT.
- Add a simple while true; do sleep 30; done to test whether the container stays alive.
- Run the image locally (docker run -p 8080:8080 image) to confirm it behaves as expected.
In almost all cases, the termination time (~4 seconds) indicates the container is exiting by itself, not being forcefully stopped by App Service.