Docker Containerization
Virtualization Vs Containerization
Advantages of Containerization
Containers are isolated, don't require an operating system, and share a host kernel. so containers run on the same server and use the same resource. they do not interact with each other because its isolated, if one application crashes, other containers with the same application will keep running without any issues.It's a portable and lightweight operating system and it contains only the required binaries, dependencies, and libraries to run the application. so it can be moved anywhere easily and run without worrying about compatibility, or dependencies kind of issue.faster and resource efficient it's very fast to boot because containers are lightweight and start in less than a second since they do not require an operating system boot.improving scalability and lower costs by allowing more containers in the environment without the need for more servers, containerization increases scalability anywhere from 10 to 100 times that of traditional VM environments.
Introduction to Docker - What is Docker on Containers
Docker Architecture and Components
Docker Installation
A few quick notes about Docker:docker-installation-on-ubuntu-article
Multiple containers run on the same hardware
Maintains isolated applications
Enables high productivity
Quick and easy to configure
Before learning about this technology, the first step is to install it. In this article, you’ll learn how to install Docker on Ubuntu.
Ubuntu:
CentOS/RHEL:
Open the terminal on Ubuntu.
sudo apt-get install docker.io
sudo systemctl status docker
Necessary comment to operate docker.
sudo docker search httpd
sudo docker pull httpd
sudo docker pull docker.io/exasol/nagios-monitoring
sudo docker images
sudo docker rmi "image id" ( to remove images)
sudo docker system df
sudo docker ps
sudo docker run -d -it --name web httpd
sudo docker exec -it web /bin/bash
sudo docker run -d -it --name web -p 80:80 httpd
sudo docker stop web
sudo docker stats web
sudo docker events
sudo docker rm web
sudo docker rm -f web
sudo docker top web
sudo docker save imange id > https-backup.tar (to take image as backup)
scp https-backup.tar ranjith@192.168.2.133:/home/ranjith/ (for SCP)
sudo docker load -i https-backup.tar ( it will load the image from local not in internet)
sudo docker commit "container Id" ( it will commit the image)
sudo docker commit d16a51d08814 customimage:2.1 (to add tag for commited images)
sudo docker run -d -it --name test1 customimage:2.1 /bin/sh ( to login custome image)
sudo docker exec -it 0b4a4fca58d6 /bin/bash ( to exec the custome image and verify)
sudo docker network inspect ff8866d57f1d
sudo docker network ls
ip a
sudo docker port web5
Docker run -i -t centos (to mount os)
docker cp aaca4f3bedb6:/opt/nagios/etc/ /root/Desktop
docker cp /root/Desktop/etc/nagios.cfg aaca4f3bedb6:/opt/nagios/etc/