Posts

Showing posts with the label docker

Deploy .Net6.0 Web api with docker

Image
  What is Docker? Docker is a containerization platform, meaning that it enables you to package your applications into images and run them as “containers” on any platform that can run Docker. It negates the classic: “It works on my computer” argument as Docker images contain everything needed for the app to run. Are Containers the same as Virtual Machines? They are similar, but not the same. In short: Virtual Machines provide OS Level Virtualization Containers provide App Level Virtualization This concept is depicted below: Why Would You Use it? In short you would use Docker, (and hence containers), for the following reasons: Portability.  As containers are self- contained  they can run on any platform that runs Docker, making them easy to stand up and run on a wide variety of platforms. Scalability.  With the use of additional “orchestration” you can spin up multiple container instances to support increased load. Performance.  Containers generally perform bette...

Understanding of Dockerfile and its commands?

Image
We have used Docker images to create containers and we pull the images from Docker Hub to create containers. But in this article,  we will see how docker images are creating and what commands are using as part of this process. Docker can build images automatically by reading the instructions from a Dockerfile . A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Think of it as a shellscript. It gathered multiple commands into a single document to fulfill a single task. build command is used to create an image from the Dockerfile.   $ docker build   You can name your image as well.   $ docker build -t my-image  If your Dockerfile is placed in another path,   $ docker build -f /path/to/a/Dockerfile  Let's first look at below Dockerfile and see those commands. FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src COPY MyMicroservice.csproj . RUN dotnet restore COPY . . RUN dotnet...