简体   繁体   中英

Internal Server Error (500) when trying to invoke a Azure Function wrapped in a Docker container

When trying to invoke an Azure Function wrapped in a Docker container all I get is an internal server error 500.

Here is what I did to create my container:

mkdir docker-function
cd docker function
func init --docker
func new (I then selected Http Trigger)
docker build -t hello-docker-function:latest .
docker tag hello-docker-function myaccount/hello-docker-function
docker push myaccount/hello-docker-function:latest

I then created an Azure Function in US Central, selected Docker (on Linux).
I then clicked Configure container settings .
As Image source I selected Docker Hub
As Repository Access I selected Public
As Image I specified myaccount/hello-docker-function
I did not specify any kind of Startup file

When invoking the function (via its URL or via the Run button) all I get is an internal server error 500.

I also tried with the Azure Container Registry - same result.

Any idea?

I've tried to reproduce the problem, and also received a 500 response code.

As it seems the problem was related to 2 things: the authentication which must be either configured or disabled and the worker runtime which must be specified.

So 2 things that made it work for me:

  1. Setting the authLevel to anonymous in function.json . If you want to enable the authentication, this question might be helpful: Http Trigger Azure Function in Docker with non anonymous authLevel

  2. In the Azure Web UI FunctionApp configuration page set the FUNCTIONS_WORKER_RUNTIME to node (I used nodeJS).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM