If you are in the IT field, there is no way that you haven’t heard of Docker. Docker is the most popular DevOPS Tool in the present world. Docker is the containerization tool. It is used in containerization of Software.
What is containerization of Software?
Let’s first talk about containers, you must be aware about containers and what they are used for. Containers are used to carry goods across oceans or for long distances. Similarly in the software world when we want to carry our software to some other machine, we use containerization. we contcontainerize our software in the container and then load it to other machine.
Why Use containerization?
Generally the big software has a lot of dependencies to run. You may have developed software on your machine with configuration such as linux machine with php version of 7 and mysql version of 5. when you give software to some other machine, that machine may contain windows OS, php version of 9 and mysql version of 6. So your software will not work on that machine. you must have to do a lot of installations before running Software.
This problem is solved by containerization. What you can do is containerize your code along with all the required tools for it in one container and load that container to another machine. you can containerize your code with Linux OS, PHP version 7 and Mysql version 6 and load it on any machine and can run directly.
Where it is mostly used?
Docker is the one tool that can make your life easy with regards to deployment or testing the software. Whenever you want to deploy any software that you developed on your machine to a production machine, it can give lots of dependency issues as well as version issues. So, here Docker is the best choice for you. You can containerize your Code with All the respective dependencies and make it ready for deplyment. Thus your deployment process will be smooth smooth like butter.
It may happen that you develop software and pass it to the testing team and they say it is not working on their machine or some particular functionality is not working. It may happen due to a mismatch of versions of dependencies. This is where Docker comes into the picture. You can containerize your Code with All the respective dependencies and then pass it to the testing team.
What is Docker Hub?
Docker Hub is just like the Port where we have to store containers. On Docker Hub there are a lot of containers available with some configurations done on them.we can call them as readymade containers. You can find containers with Ubuntu installed, Php containers with whatever version you want, mysql containers with whatever version you want etc. You can find docker hub on the following url: https://hub.docker.com/.
What is Docker Image?
Docker Images are just like a template to start with. they are like an initial that your container can start with. If you have a particular image on your machine, then you can make multiple copies of that image called a container and can customize those containers according to your need. It is just like creating multiple objects of a particular class, here class can refer to Docker Image.
let’s understand by example, you can have an image of ubuntu:20.0.4 on your machine. With this machine you can create containers such as PHP+MYSQL on Ubuntu, Django on Ubuntu, Node JS on Ubuntu etc.
Steps to Install Docker Desktop on Windows
Steps to Install Docker on Ubuntu
https://download.docker.com/linux/ubuntu/dists/, choose your Ubuntu version, then browse to
s390x, and download the
.debfile for the Docker Engine version you want to install
$ sudo dpkg -i /path/to/package.deb
$ sudo docker run hello-world
Popular Docker Commands
check the Docker version
$ docker version
get help with docker command
$ docker <command> --help
list all the available docker images on your machine
$ docker images
pull particular Docker Image from Docker Hub
$ docker pull <image_name>
eg: docker pull ubuntu
remove particular image from local machine
$ docker rmi <image_name>
eg: docker rmi ubuntu
list all the containers available on local machine
$ docker container ls -a
start a particular container
$ docker start <container_id>
eg: “docker start 6f8602b79294” you can get container id with command
$ docker container ls -a
to stop a particular container
$ docker stop <container_id>
eg: docker stop 6f8602b79294
to pause a particular container
docker pause <container_id>
eg: docker pause 6f8602b79294
to resume paused container
docker unpause <container_id>
eg: docker unpause 6f8602b79294
to kill running container
docker kill <container_id>
eg: docker kill 6f8602b79294
to remove the container
docker rm <container_id>
eg: docker rm 6f8602b79294