Monday, September 28, 2020

Updating Dockerfile and rebuilding images using VisualStudio

 In the previous post we saw on how to create a .Net Core console App and use Visual Studio to automatically add Dockerfile to the project. In this post, we will see how to change the Dockerfile created by Visual Studio and rebuild the Docker image with the modified file.

Once the Dockerfile is created we can manually exit the Docker file Add/Modify steps and rebuild the Docker image.

In this sample, we will add proxy settings to enable package restore in a Corporate firewall environment.

Create Dockerfile and Container using Visual Studio

 Visual Studio provides an option to automatically add Docker support. Using Visual Studio we can add the Dockerfile to a project without having to manually create one. Visual Studio will create the Dockerfile with the commands pre-populated based on the type of project, we create. 

In this post, we will create a Console application using .Net Core and use Visual Studio to automatically create the Dockerfile for the Project. First, let us create the following Console application.

Docker Getting Started

Friday, September 25, 2020

Building an ASP.Net Core Web App Docker image

 In this post we shall see how to create a basic Asp.Net core Hello World App and package it into a Docker image. We will deploy the image as a Docker container and execute the Asp.Net Core application from Docker.

First let us start by creating an Asp.Net Core application using Visual Studio 2019

Building a Node App Docker image

 In the previous post we saw how to build a HelloWorld Docker image, in this post we will create a Docker image for a Node.js application.

First let us create a basic Node server using Express which will respond with a Greeting message in the root path (/).

Building a HelloWorld Docker images

 We have seen how to pull a Docker image from DockerHub and run in, now we will see how to create our own Docker image, build and run it.

The first step to create a Docker image is to create a Dockerfile.
Dockerfiles is a text file that contains instructions and steps to create a new Docker image.

A Dockerfile has no extension. If you are using docker on windows use notepad to create a dockerfile while saving select "All type" and save the file name as "Dockerfile".

Friday, September 18, 2020

Listing and Removing Docker Images

In the previous post we saw on how to pull and run Docker Images from a remote repository. Once we pull a Docker Image, it gets stored in the local repository. We can use the image ls command to view the list of images in the local repository.

Listing and Removing Docker Containers

Docker supports a set of commands to operate on Docker Containers. It supports commands to list Containers, Remove containers etc. Below are some of the commonly used commands for Docker Containers.

Pulling Docker Images

In the previous post we executed the docker run command and noticed that the Docker Engine automatically pulled the hello-world image from DockerHub. We can also use the docker pull command to explicitly pull Docker images from the remote repository (DockerHub) to our local DockerRepository.

To pull images from the remote repository to the local repository we need to use the docker pull command as follows.

Running first Docker Container

Once we install Docker and make sure it is up and running we can start running our first Docker Container. Let us run the hello-world Docker container, this container is present in the DockerHub. We will use the docker run command to run the container as follows.

Monday, September 14, 2020

Docker Desktop

 Depending on the version of Windows operating system, we need to either install the Docker Toolkit or Docker Desktop. For Windows version less than 10, we cannot install Docker Desktop for these versions we need to install Docker Toolkit. For Windows 10 we can install Docker Desktop. It is recommended to install Docker Desktop.

Once Docker Desktop is installed, it will start and we can see an icon in the Toolbar.

Installing Docker

 To get started with using Docker we need to download and install the Docker setup. Docker can be installed in multiple platforms Windows / Mac / Linux. We can get the appropriate version of Docker from the below link and install it to get started.

https://docs.docker.com/get-docker/

Friday, September 11, 2020

Docker Overview

What is Docker Network?

 As the name suggests Docker network allows docker containers to communicate with other containers and with the outside world. Docker supports different types of Network configuration depending on the name of the Application / Docker container setup.

Monday, September 7, 2020

What is Docker Engine?

 The Docker Engine is the heart of the Docker platform, it consists of 2 main parts.
                The Client side (Docker CLI & Rest API) is used to fire commands
                The Server side (Docker Daemon) is used to process the commands and manages Containers.

What is Docker Hub?

 Docker Hub is a service provided by Docker for finding and sharing container images. It allows us to push new images and pull existing images from the Hub. DockerHub is like GitHub we can user push/pull commands to manage Docker images. GitHub allows us to store and version controls our source code, while DockerHub allows us to store and version control Docker Images

DockerHub is the default registry used by the Docker engine. DockerHub hosts public and private repositories, it also provides automated builds, organization accounts, and integration with source control solutions like Github and Bitbucket. 

What is Docker Registry?

A Docker Registry is a storage and distribution system for named Docker images. The Docker registry is used to store the static Docker image templates. The same image might have multiple different versions, identified by their tags. 

A Docker Registry is organized into Docker repositories, where a repository holds all the versions of a specific image. The registry allows Docker users to pull images locally, as well as push new images to the registry. 

DockerHub is the default registry used by the Docker engine, it is the Docker's public registry instance. It is possible to run on-premise the open-source Docker registry/distribution, as well as a commercially supported version called Docker Trusted Registry

Sunday, September 6, 2020

What is Docker Daemon?

 The Docker Engine has a client-server setup where can client can fire commands and the Server processes the commands to create and maintain live Docker Containers.

Docker Daemon is the server-side of the Docker Engine, all running Docker Containers are managed by the Docker Daemon. Docker CLI and API are the client-side of the Docker Engine which sends commands to the Docker Daemon. A daemon can also communicate with other daemons to manage Docker services.



What is a Docker Image?

 A Docker Image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings. A Container image is a static template version of a Docker Container, it is stored in the Docker registry. 

Container images become containers at runtime and in the case of Docker containers - images become containers when they run on Docker Engine.

When we execute the $ docker run command the container image is fetched from the registry and loaded in the Docker Daemon server to make it a live executing container.

Thursday, September 3, 2020

What is a Docker Container?

When we develop an Application and move it between various environments QA, Staging, Production etc, we need to take care of various environmental factors like Operating System version, security patches, network configuration etc. When there is any deviation in these settings the application starts behaving differently and becomes difficult to identify the cause.

Containers help us make this easier, Containers are an abstraction at the app layer that packages code and dependencies together. A Container packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in userspace. Containers take up less space than VMs.

Docker Container vs Virtual Machine

A Virtual Machine is an image that runs on top of a physical server. We can create multiple Virtual Machines on top of a physical server. Each Virtual Machine needs a Guest operating system to function, this makes is heavier since each Guest OS needs Memory, Disk, and CPU to operate. 

A Docker Container can be seen as the next version/improvement to a Virtual Machine. Each Virtual Machine in a server needs a separate Guest operating system to function, but all the Docker Containers in a server use the same underlying Operating System of the server, hence Dockers are lightweight when compared to Virtual Machines. Also, Dockers are faster to spin up and execute when compared to Virtual Machines.

Since each Docker containers don’t need a separate Operating System we can spin up many Docker Containers in a server then the number of Virtual Machines it can handle.

What is Docker?

Docker is an open platform to create, deploy and run applications by using Containers. Docker makes is easy to deploy applications from one environment to another. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package.

Docker can be seen as an improvement to a Virtual machine. Each Virtual Machine in a server needs a separate Guest operating system to function. All the Docker Containers in a server use the same underlying Operating System of the server, hence Dockers are lightweight when compared to Virtual Machines. Also, Dockers are faster to spin up and execute when compared to Virtual Machines.

The Docker platform contains the following components