Azure supplies a PAAS service to host your software. It supplies flexibility and scalability and takes the burden of server administration from the consumer nevertheless it typically can turn out to be a headache to deploy your software on app service, particularly once you’re utilizing a know-how stack aside from .Internet. For this, we are able to use docker primarily based deployment so your software works completely on the server too.
To deploy functions on the Azure App Service via Docker we’d like the next steps,
Step 1 – Create a Docker File
- Create a Docker file via Docker VS Code extension. Go to VS code marketspace and set up Docker extension
- Click on on View -> Command Palette-> Docker: Add Docker file to workspace
- Choose know-how, OS
- Attempt to create the Docker file in the identical listing which accommodates your code.
Step 2 – Create Docker Picture
To create Docker picture via Docker file run the next command
- docker construct -t imagename:tag .
-t means we need to run the command within the connected kind so we are able to see the logs
Imagename:tag tag is to take care of the totally different picture model
outline that run the Docker file within the present listing
Step 3 – Create Container to check your software
To create the Docker container from the Docker picture run the next command
- docker run –publish 8000:8000 -t –name containerName imagename:tag
–publish hostport:guestport so, we are able to connect our container port to our visitor OS port
Now check your software by sending a request to 8000 port of your guestip:8000 to see in case your software is working in container or not.
Step 4 – Push Docker Picture to Azure container registry
Step 5 – Deploy the Picture to APP service
- Choose the Docker extension and choose the container registry on which the applying is deployed
- Proper Click on on the picture you need to deploy
- Choose the choice “deploy to app service”
- Enter the title of the app service and useful resource group