Hello @Sachitha Abeydeera
To deploy an Ubuntu-based Docker container in Azure Functions, you can follow the steps below:
- Create a Dockerfile with the necessary dependencies and configurations. You have already done this step.
- Build the Docker image locally using the following command:
docker build -t .
- Test the Docker image locally using the following command:
docker run -p 8080:80
This command maps port 80 in the container to port 8080 on your local machine. - Push the Docker image to a container registry such as Docker Hub or Azure Container Registry.
- Create an Azure Function app with a custom container using the Azure CLI or Azure portal.
- In the Azure portal, go to the Function app's Configuration settings and add an app setting with the key
WEBSITES_PORT
and the value80
. - In the Azure portal, go to the Function app's Container settings and configure the container settings as follows:
- Image source: Select the container registry where you pushed the Docker image.
- Image and tag: Enter the name of the Docker image and the tag you want to use.
- Startup command: Enter the command to start the function app. In your case, it should be
func host start
.
- Save the container settings and restart the Function app. Regarding the error you are facing, it seems to be related to the health check configuration.
You can try disabling the health check by adding the following app setting to your Function app: WEBSITE_HEALTHCHECK_PATH = ""
This should disable the health check and allow your Function app to start.
I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.