Docker is a platform that allows developers to easily create, deploy, and run applications in containers. Containers are lightweight, portable, and self-sufficient, making it easy to distribute and run applications on any system.


Docker uses a technology called containerization, which is a form of operating-system-level virtualization. Containers allow developers to package an application and its dependencies together in a single package, called an image. These images can then be run on any system that has the Docker engine installed, making it easy to deploy and run applications in a variety of environment.


→ To run docker container you should have atleast 3.6 later and it should be 64 bit

→ Using one single image you can create multiple docker containers

→ Docker does not require any account if you pull images from public repo

→ Docker does require accounts if you pull images from private repo

→ Using docker file we can create docker images.

→ Docker has been classified into three different network platforms - Bridge, None, host

→ Docker has three type of docker volumes - bind mount, volume, (tmpfs mount - This is not used coz it goes away when container is deleted)

→ Bind mount - you can mount any area from your docker engine host paths to docker containers

→ Volume - you can mount only docker area paths - (/var/lib/docker/volumes) to docker container

→ Docker service is the command to talk to all nodes from Swarm manager

→ When ever swarm is created it also creates the ingress - overlay network - because it needs to discover to other nodes docker network ls to view it.

→ Docker compose file contains the complete code of your entire architecture of your application (web-app-db)



▫ To become root user in cloud = sudo su

▫ To get the linux info -type : uname -r

▫ To get the linux os : cat /etc/os-release

▫ To get docker images : docker images

▫ To get exited containers : docker ps -a



▫ To get help for the docker commands : docker volume ls help, docker network ls help

▫ To get the information about the docker : sudo docker info

▫ To get the usage of images and containers in the disk - sudo docker system df

▫ To get the usage of usage status - sudo docker stats

▫ To get the running status of docker - docker ps



▫ To pull a image from docker hub - docker pull httpd

▫ To run a container - docker run httpd, just simply runs with random app name

▫ To run a container with custom name - docker run --name webapp1 httpd

▫ To create a container from image - docker create -name webapp httpd (not used often)

▫ To check the all container status - docker ps -a


▫ To get inside the container - docker exec -it webapp0 /bin/sh ( -it refers to interactive mode and /bin/sh gets you to bash mode)

▫ To get to know what commands you can use in container - cd /bin and cd /sbin, this will list out all the commands you can execute.

▫ Without getting into container you can also execute commands from outside - docker exec webapp0 uname - r, docker exec webapp0 mkdir /tmp/rake

▫ To copy file from local to docker container - docker cp server.info webapp0:/tmp or containerid:/tmp

▫ To copy fime from container to linux local - docker cp webapp0:/tmp /tmp/local ( just reverse from the above command)



▫ To start the container - docker start webapp0 (Either enter the container name or container id)

▫ To stop the container - docker stop webapp0

▫ To remove a container - docker rm webapp0 (before that make sure container is stopped)

▫ To get the logs of container - docker logs webapp0 (it shows only the container event logs) for app logs you need to go inside the container 

▫ To check the status of the particular container - docker stats webapp0



▫ To check the usage status of the particular container - docker top webapp0

▫ To delete the unwanted or exited container - docker system prune

▫ To pull docker images from docker hub - docker pull ubuntu, docker pull ubuntu:specifytag name if you want particular image

▫ To run the application on the network port, you need to specify it - docker run -it -d --name webapp0 httpd -p 81:80



▫ To know on which port the docker continer is running or exposed ports - docker inspect webapp0 or docker inspect httpd

▫ To know what are all the changes happened to the docker images - docker history (image name)

▫ To backup a docker image - docker save httpd:latest > httpd-bkp.tar

▫ To extract the docker image from tar format - docker load -I httpd-bkp.tar

▫ To securely transfer one file from one host to another host - scp httpd-bkp.tar 10.0.0.1:/tmp


▫ Removing images - docker rmi httpd (make sure to stop any running container and also remove it before)

▫ Creating docker image from container - docker commit <container-id>  custom-image:3.1 

▫ Renaming the docker image - docker tag customer-image:3.1 9639/realme:3.1

▫ Pushing image to repository - docker push 9639/realme:3.1 (imagename)