I have an docker image containing a .NET Core 3.0 API application that I have pushed to docker hub.
Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["pswebapi.csproj", ""]
RUN dotnet restore "./pswebapi.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "pswebapi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "pswebapi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "pswebapi.dll"]
Inside of Azure, i'm creating a Web app for containers. However, the container seems to fail to start according to the logs:
2020-01-18 18:02:43.659 INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2020-01-18 18:02:44.181 INFO - Initiating warmup request to container webapibrajzore_0_66ddf497 for site webapibrajzore
2020-01-18 18:02:44.310 ERROR - Container webapibrajzore_0_66ddf497 for site webapibrajzore has exited, failing site start
2020-01-18 18:02:44.312 ERROR - Container webapibrajzore_0_66ddf497 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2020-01-18 18:02:44.326 INFO - Stoping site webapibrajzore because it failed during startup.
I have tried to set both PORT and WEBSITES_PORT to 80 in the configuration, but it don't work.
Edited: Added doc details
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for your comment. We are actively investigating and will get back to you shortly. Thanks for your patience.
When I try to deploy a windows container, I get this error message:
Unable to start container. Error message: Open Compute System failed.
So none of the Linux and windows containers works for me.
@Bryankarlsson
Since the doc issues are meant to provide feedback on a specific Azure doc, please provide us with the link to the documentation you are referring to so we can better assist.
@Karishma-Tiwari-MSFT Well, I'm following the instructions of how to deploy a docker container to Azure: https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-docker-webapp?view=azure-devops&tabs=java
@VikasPullagura-MSFT @Karishma-Tiwari-MSFT @femsulu the exact same issue that I have can be found here as well in the follwing started issue:
https://github.com/MicrosoftDocs/azure-docs/issues/34451
I have alsoe posted a thread there.
@Bryankarlsson, The automatic port detection detects the port (port 80 is the default), we will attempt to detect which port to bind to your container, but you can also use the WEBSITES_PORT app setting and configure it with a value for the port you want to bind to your container. However, the web server in your custom image may use a port other than 80. You tell Azure about the port that your custom container uses by using the WEBSITES_PORT app setting. In this case, yes you will have to change the App Setting configuration from the Portal.
For a different port - Use the EXPOSE instruction in your Dockerfile to expose the appropriate port (E.g 3000) and use the WEBSITES_PORT app setting on Azure with a value of "3000" to expose that port.
Could you please scale-up your App Service Plan and then re-try while I check further on this with your website name.
@AjayKumar-MSFT I'm not sure what it is that you want me to do? I have expsed port 80 in my docker file. Should that not work?
Tell me exactly what you want me to test.
@Bryankarlsson, Sorry for any confusion! In your comment on the other referenced GitHub issue "Must I set some settings in Configuration -> Application settings in Azure?" ; so in this regard, I had mentioned about using a different Port with the app setting : You can use a different port and then set the application setting with that port using WEBSITES_PORT app setting and see if that makes any difference. As per your case, by default the port 80 should work as only port 80 and 8080 are exposed ports. To isolate, we could try the following steps:
For Windows Container, could you please check if the base image is 2016 and if so kindly leverage the Windows Server 2019 base image (for example: microsoft/aspnet:4.7.2-windowsservercore-ltsc2019) and check if that helps.
An added benefit of this change will be faster load times and higher cost effectiveness due to significantly smaller image size. Please check this announcement for more info on this: https://azure.microsoft.com/en-us/updates/windows-server-2019-support-added-to-public-preview-of-windows-container-support/ .
Could you please confirm if this is your WebApp name 'webapibrajzore'? I'm unable to locate this.
Or could you share the WebApp name directly here or indirectly and also the base image you're leveraging.
Since we have not heard back from you we will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply here or on the other thread and we will gladly continue the discussion.
I just ran in to this issue as well. Pretty much the same premise as OP.
I can build and run my asp net core in Docker Desktop. No issues.
But I get the exackt same error when I try to run it in Azure Web App with a Linux service plan (have not tried windows as it is 2x the price).
I can copy and paste the docker run command that Azure uses (just replacing the image for my local build name) and it works just fine.
docker run -d -p 4880:80 --name web-testmctest-0_e32966d1 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=web-testmctest -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=web-testmctest.azurewebsites.net -e WEBSITE_INSTANCE_ID=5c997bc5776941ff3fb1eb90537ac2f83e1afffea565b14577d6ea1fb7356b3d -e HTTP_LOGGING_ENABLED=1 web-testmctest.azurecr.io/web-testmctest:bt -e WEBSITES_PORT=80 -e environment='Production' -e ASPNETCORE_ENVIRONMENT='Production'
The error:
Container web-testmctest_0_e32966d1 for site web-testmctest has exited, failing site start
Container web-testmctest_0_e32966d1 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
(I've obfuscated some of the service names and urls as not to expose my real values)
I've been banging my head against this for days. But I finally figured it out.
Removing the ' from the environment names variables solves the issue, this works:
-e environment=Production -e ASPNETCORE_ENVIRONMENT=Production
Both with and without the ' works in my docker desktop, but Azure fails horribly with no good error message if you have the '
I have specified these extra startup values in Web App > Container Settings > Startup File (form field), same value can be edited from Web App > Configuration > Startup Command (its the same field with a different name).
I've been banging my head against this for days. But I finally figured it out.
Removing the ' from the environment names variables solves the issue, this works:
-e environment=Production -e ASPNETCORE_ENVIRONMENT=Production
Both with and without the ' works in my docker desktop, but Azure fails horribly with no good error message if you have the '
I have specified these extra startup values in Web App > Container Settings > Startup File (form field), same value can be edited from Web App > Configuration > Startup Command (its the same field with a different name).
Apologies for all the frustration with this issue and inconvenience. I will share the feedback on this internally with our product team.
Kindly let us know if you need any further assistance. Thanks for sharing the solution that worked for you with the community.
I've been banging my head against this for days. But I finally figured it out.
Removing the ' from the environment names variables solves the issue, this works:
-e environment=Production -e ASPNETCORE_ENVIRONMENT=Production
Both with and without the ' works in my docker desktop, but Azure fails horribly with no good error message if you have the '
I have specified these extra startup values in Web App > Container Settings > Startup File (form field), same value can be edited from Web App > Configuration > Startup Command (its the same field with a different name).
Apologies for all the frustration with this issue and inconvenience. I will share the feedback on this internally with our product team.
Kindly let us know if you need any further assistance. Thanks for sharing the solution that worked for you with the community.
I'm very sorry, could you shed any more light on this? What is it that must be changed?
I'm very sorry, could you shed any more light on this? What is it that must be changed?
This works locally with docker desktop: -e environment='Production' -e ASPNETCORE_ENVIRONMENT='Production'
But not in Azure.
This works in Azure
-e environment=Production -e ASPNETCORE_ENVIRONMENT=Production
note the missing '
Facing the same issue as mentioned by @Bryankarlsson. Tried out all the suggestion but no luck as of now. Please find the container logs of the app service.
2020-09-02T17:48:32.007Z INFO - Pull Image successful, Time taken: 0 Minutes and 35 Seconds
2020-09-02T17:48:32.068Z INFO - Starting container for site
2020-09-02T17:48:32.069Z INFO - docker run -d -p 8166:80 --name thintankcoreapi_0_5aec585a -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=thintankcoreapi -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=thintankcoreapi.azurewebsites.net -e WEBSITE_INSTANCE_ID=2a1ab72b2d9ad013ac740eb676404cb06c512c8203547cc3d3c76b3dfea53aee -e HTTP_LOGGING_ENABLED=1 vivek781113/corebase31
2020-09-02T17:48:35.526Z INFO - Initiating warmup request to container thintankcoreapi_0_5aec585a for site thintankcoreapi
2020-09-02T17:48:36.196Z ERROR - Container thintankcoreapi_0_5aec585a for site thintankcoreapi has exited, failing site start
2020-09-02T17:48:36.198Z ERROR - Container thintankcoreapi_0_5aec585a didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2020-09-02T17:48:36.210Z INFO - Stopping site thintankcoreapi because it failed during startup.
Most helpful comment
@Bryankarlsson, The automatic port detection detects the port (port 80 is the default), we will attempt to detect which port to bind to your container, but you can also use the WEBSITES_PORT app setting and configure it with a value for the port you want to bind to your container. However, the web server in your custom image may use a port other than 80. You tell Azure about the port that your custom container uses by using the WEBSITES_PORT app setting. In this case, yes you will have to change the App Setting configuration from the Portal.
For a different port - Use the EXPOSE instruction in your Dockerfile to expose the appropriate port (E.g 3000) and use the WEBSITES_PORT app setting on Azure with a value of "3000" to expose that port.
Could you please scale-up your App Service Plan and then re-try while I check further on this with your website name.