What is containerization?
Containerization is approach in which application, dependencies and its configuration are all packaged together as container image.
So, if a application requires, unix environment, with Java8 installed, with Tomcat installed and application artefacts placed in certain directory, all this will be part of container image.
Just as shipping containers, which allow items to be transported by ship, train, or truck independent of the items inside, software containers act as a standard unit of deployment that can contain different code and dependencies which can be deployed across different environments.
What is container instance?
When the container image is deployed and is running, it is called a Container Image Instance.
They are also sometimes just referred as Container Instances or sometimes called just Containers.
Does containers run directly on any OS or they need any engine?
Containerized applications run on top of a container host. And container host or daemon, in turn run on top of operating system.
Are containers scalable?
Yes, apart from general benefits of containers, another benefit of containerization is scalability. You can scale up or down using containers very easily.
Consider, container image contains all dependencies, and you have already downloaded on your local system, you just need to start or stop more instances of this container image.
What is difference between docker containers and virtual machines?
|Containers are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in user space. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications and require fewer VMs and Operating systems.||Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. The hypervisor allows multiple VMs to run on a single machine. Each VM includes a full copy of an operating system, the application, necessary binaries and libraries – taking up tens of GBs. VMs can also be slow to boot.|
Do you know different types of Containers?
What is Docker?
Docker is a platform which packages an application and all its dependencies together in the form of container image and run these containers.
When we say dependencies, we mean an application need unix environment, with java installed, with some scripts or libraries installed, with certain folders created, and application installed into a specific location.
So a developer can build a container image having different applications installed on it and give it to the QA team. Then the QA team would only need to run the container image to replicate the developer’s environment.
Three important concepts related to Docker are:::
- Docker Images
- Docker Containers
What is Dockerfile?
Docker images are built based on a Dockerfile. A Dockerfile defines all the steps required to create a Docker image with your application configured and ready to be run as a container.
It’s like a batch script, the first line states the base image to begin with and then follow the instructions to install required programs, copy files and so on, until you get the working environment you need.
For example, dockerfile will have instructions like:
- Use Unix image as base image
- Install Java on it
- Copy your application artifacts on it
- Open ports
What is docker image?
Docker image is created from Dockerfile. So if you understand that Dockerfile contains instructions to include environment, framework, artefacts, configurations etc, then you can very well understand that Docker image actually contains all these.
An image includes everything, from operating system to all the dependencies (such as frameworks) plus deployment and execution configuration to be used by a container runtime.
Having everything within the image allows you to migrate images between different environments and be confident that if it works in one environment, then it will work in another.
What is docker container?
Docker Container is a running instance of a Docker Image. It is also called as just container or container instance.
A container represents the execution of a single application, process, or service. When scaling a service, you create multiple instances of a container from the same image.
What is Docker Registry?
Docker Registry is used for storing docker images.
It can be either a user’s local repository or a central repository that is available to public like a Docker Hub, which allows multiple users to share registry.
If you understand maven then you can compare it with maven repositories.
- Azure Container Registry
- Google Cloud Registry
- Docker Hub
What is Docker Engine?
Docker Engine is the underlying client-server technology that builds and runs containers using Docker’s components and services. Docker Engine supports the tasks and workflows involved to build, ship and run container-based applications.
When people refer to Docker, they mean either Docker Engine — which comprises the Docker daemon, a REST API and the CLI (command line interface, which actually talks to Docker daemon through the API).
The engine creates a server-side daemon process that hosts images, containers, networks and storage volumes.
Docker Engine accepts docker commands from the CLI, such as docker run <image>, docker ps to list running containers, docker image ls to list images, and so on.
How is complete process looks like when using docker?
Here is complete process, step wise:
- Create an app or service, and build the artefacts
- Write/Update Dockerfile
- Build Docker image from Dockerfile
- Push Docker image to Registry (optional)
- Run Docker image to create Docker container instance.
What are different containers available and what type of container is docker?
Different types of containers present are:
Docker is LXC type.