API / Docker Interview questions
Docker is a containerization platform which packages your application and all its dependencies together in the form of containers so as to ensure that your application works seamlessly in any environment, be it development, test or production.
Docker containers, wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries, etc. It wraps basically anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.
Container is a way to package applications with all the necessary dependencies and configuration. Containers are portable artifacts, easily shared and moved around. It makes development and deployment more efficient.
- Container repository.
- private repositories.
- public repository for Docker.
Docker containers include the application and all of its dependencies. It shares the kernel with other containers, running as isolated processes in user space on the host operating system. Docker containers are not tied to any specific infrastructure: they run on any computer, on any infrastructure, and in any cloud. Docker containers are basically runtime instances of Docker images.
Docker image is the source of Docker container. In other words, Docker images are used to create containers. When a user runs a Docker image, an instance of a container is created. These docker images can be deployed to any Docker environment.
- Application agility,
- Developer productivity,
- Easy modeling,
- Placement and affinity,
- Caching a cluster of containers,
- Operational efficiencies such as flexible resource sharing,
- Scalability,
- Better security, less access needed to work with the code running inside containers, and fewer software dependencies
The three main Docker components are:
Docker Client performs Docker build pull and run operations to open up communication with the Docker Host. The Docker command then employs Docker API to call any queries to run.
Docker Host contains Docker daemon, containers, and associated images. The Docker daemon establishes a connection with the Registry. The stored images are the type of metadata dedicated to containerized applications.
Registry is where Docker images are stored. There are two of them, a public registry and a private. Docker Hub and Docker Cloud are two public registries available for use by anyone.
Virtualization is the process of employing software (such as Hypervisor) to create a virtual version of a resource such as a server, data storage, or application. Virtualization lets you divide a system into a series of separate sections, each one acting as a distinct individual system. The virtual environment is called a virtual machine.
Virtualization is an abstraction of a physical machine, while containerization is the abstraction of an application.
Some of the lifecycle processes include,
- Create container,
- Run container,
- Pause container,
- Unpause container,
- Start container,
- Stop container,
- Restart container,
- Kill container,
- Destroy container.
build, Builds a Docker image file.
commit, creates a new image from container changes.
create, creates a new container.
dockerd, launches Docker daemon.
kill, kills a container.