What is docker ? How to Install it and run ? Learn docker easy

What is Docker: Docker is a computer program that performs operating-system-level virtualization also known as containerization.

How to install docker in ubuntu or Centos:
To install docker in ubuntu, go to https://get.docker.com/ . you can see there 2 commands run them in terminal.
# curl -fsSL get.docker.com -o get-docker.sh


# sh get-docker.sh

How to install docker in RHEL 7:
To install docker in RHEL run following commands in terminal.
sudo yum install -y yum-utils   device-mapper-persistent-data   lvm2
sudo yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
sudo yum-config-manager --enable docker-ce-test
sudo yum install docker-ce -y
yum install -y --setopt=obsoletes=0   docker-ce-17.03.1.ce-1.el7.centos   docker-ce-selinux-17.03.1.ce-1.el7.centos

How to login to docker ?
To login to docker you need to give command # docker login (username)
Then it will prompt for password then give password which is used while creating docker account.

Docker pull:
Docker pull is a docker command which pulls images from docker hub:
Ex: docker pull ubuntu Or docker pull cent os

Docker images: A Docker Image is the template needed to build a running Docker Container
To check what the images are present in your docker, give command # docker images

How to check images in docker ?
# docker images  is a command to check existing images in docker.
# docker images –q is a command to check all images ids.

Docker containers: Docker containers isolate applications from one another and from the underlying infrastructure.

How to check running containers ?
# docker ps  is a command to check running containers in docker.
# docker ps –q is a command to check all containers ids which are running.
# docker ps –a is a command to check all containers running and stopped.
# docker ps –a  –q is a command to check all containers running and stopped ids.

Entering into docker container:
To enter in to particular docker container we have 2 ways
# docker attach (container id)
# docker exec –it ubuntu /bin/bash
If you use # docker attach (container id),while exit container will stop with # exit command. In this scenario you need to exit by command Ctrl+p+q

If you use # docker exec –it ubuntu /bin/bash you can exit with # exit command. In this scenario container wont stop.

How to start docker container with out entering into it ?
# docker start (container id) will start your docker container.

How to stop docker container ?
# docker stop (container id) will stop your docker container. It may take 10 sec of grace time to stop container

What is docker kill ?
# docker kill (container id) will kill your container immediately.

Docker search: Docker serch is a command to check available images in docker hub from terminal.
# docker search (image) Ex: docker search ubuntu or docker search vamseenath


Popular posts from this blog

How to Install Apache Tomcat in RHEL

Learning Linux basic commands for Devops

NO.1 Devops Interview Questions