Introduction to Linux Containers and Docker
The
Linux Containers (LXC) feature is a lightweight virtualization mechanism that
does not require you to set up a virtual machine on an emulation of physical
hardware.
Makes use of:
1)
Namespaces: User, Network, Hostname, Filesystem, Process table
2)
Cgroups for resource limits
3)
Seccomp – filtering of system calls
4)
AppArmour/SELinux
5)
Like chroot environment only more secure and more full featured
Benefits are - Application isolation, Near
native performance, and Dynamic control of resource allocation (thin
provisioned)
Limitations – All use hosts kernel
DOCKERS
Docker
consists of the Docker Engine, which packages and runs the applications, and
the Docker Hub Registry, which shares the applications in a Software-as-a-Service (SaaS) cloud. The
philosophy of Docker and Linux Containers philosophy is different. Docker works towards Portability,
Standardized Environments, Rapid scale-up/scale-down, Ability to build a
continuous delivery (CD) pipeline and Dependency management.
Why
Docker? - For
Faster Application Development, suits agile development, easy multiplication of
environments and meets Scaling Requirements.
Container
for Docker is
based on Namespaces, cgroups (control groups) and copy-on-write.
Container
Build System is to
define a Docker file which is recipe describing the build process, very easy to
learn, supports caching (like git) and is highly reliable & reproducible.
Container
images as
compared to VM images are much smaller as they do not require hardware support,
kernel or driver, no separate handling of logs, metrics, backups, all done only
by host, if required. Layered architecture, like 1 layer = 1 build step, is
based on git and using copy-on-write, only difference is committed as a new
layer.Docker Image Distribution is through Docker Registry same as git
repositories.
Docker
ecosystem, apart from millions of images is being integrated in
thousands of projects like Dashboard, testing system, etc. Some official
projects/tools that should be noted are: Machine (deploy Docker hosts); Compose
(Manage multi-container applications) & Swarm (cluster multiple Docker
hosts together)
How to
dockerize an application?
1) Write a dockerfile for the main component.
2.) Write a docker-compose.yml for the app.
3.) Use Docker+Compose during development.
4.) Use Docker+Compose for
testing/QA/Acceptance,.
5.) Go to production using Docker+Compose
If you
have 100s of containers build self-service container. Note: libcontainers is
built by Docker and used as default container technology
For more information on on
libcontainers Vs Linux containers visit https://www.brighttalk.com/webcast/286/160339
To know more email: blog@calsoftinc.com
Contributed by: Shriram Pore | Calsoft
Inc.
