Perform the following steps:
- The first step in creating a Docker image is to create a Dockerfile in our Visual Studio project. Create a .Dockerfile with the following contents:
FROM microsoft/azure-functions-dotnet-core2.0:2.0
COPY ./bin/Release/netstandard2.0 /home/site/wwwroot
- Then, navigate to Command Prompt and run the following Docker command, docker build -t functionsindocker ., taking care not to miss the period at the end of the command, to create a Docker image. Once you execute the docker build command, you should see something similar to that shown in the following screenshot:
- Once the image is successfully created, the next step is to run the Docker image on a specific port. Run the command to execute it. You should see something like the following screenshot:
- Verify that everything is working fine in the local environment by navigating to the local host with the right port, as shown in the following screenshot.