Understanding Virtual Machines and Containers
What is a Virtual Machine
• A virtual machine is a computer file, typically called an image, which behaves like an actual computer – a computer within a computer
• It runs in a window, much like any other program, giving the end-user the same experience on a virtual machine as they would have on the host operating system itself.
• Multiple virtual machines can run simultaneously on the same physical computer.
What is Docker and its Benefits
• Docker is an open-source platform for developing, shipping and running applications by using containers.
• Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
• With Docker, you can manage your infrastructure in the same ways you manage your applications.
The Docker platform uses the Docker Engine to quickly build and package apps as Docker images created using files written in the Dockerfile format that then is deployed and run in a layered container.
Benefits of Docker:
1. Resource Efficiency: Docker is lightweight and fast. Process level isolation and usage of the container host’s kernel is more efficient when compared to virtualizing an entire hardware server using VM.
Docker Architecture and its Taxonomy
Docker Engine is a client-server application with these major components:
• A server which is a type of long-running program called a daemon process.
• A REST API that specifies interfaces that programs can use to talk to the daemon and instruct it on what to do.
Create an Image Manually
Step 1: Update the Code
1. Create a New Project - HelloWebApp dotnet new MVC -n HelloWebApp
2. Add docker file as below Dockerfile
Azure Pipeline for Build and Publish Docker Image to Docker Hub
Azure Pipelines can be used to build images for any repository containing a Dockerfile. The building of both Linux and Windows containers is possible based on the agent platform used for the build.
Deploying to Web App
You can automatically deploy your application to an Azure Web App for Linux Containers after every successful build.