Understanding Docker And It's command

Docker is being used widely in organizations and it is for good. Let's use understand how.

What is Docker?

It is an open-source containerization platform for developing, shipping, and running applications. It enables to separate applications from the infrastructure (Operation System)

Why Docker?

It provides the ability to package and run an application in a loosely isolated environment called a container on a given host. When we run a containerized application comparatively it takes significantly lower memory of the host machine. 

Docker Desktop is an easy-to-install application for your Mac or Windows environment that enables you to build and share containerized applications and microservices.

Let's see some of the useful command which we need mostly.

#Switch between windows and linux container

& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon 

#To see all the top running images

docker images 

#To see all the images

docker images -a

#To see all the running containers

docker ps

#To see all the containers

docker ps -a

#To stop the running container 

docker stop <first 3 letters of containerid>

#To remove container

docker rm <first 3 letters of container id>

#To remove image

docker rmi <first 3 letters of image id> -f

#It'll create image in a container

docker build -t <name:tag>

#It'll run the rabbitmq

docker run -d --hostname my-rabbit --name some-rabbit -p 5672:5672 -p 15672:15672 rabbitmq:management

#It'll run sql server

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Pwd12345!" -p 11433:1433 -d mcr.microsoft.com/mssql/server:2017-latest 

#To check log

docker logs <first 3 letters of containerid> --follow

#For network related command

docker network ls
docker network create my-net
docker network connect bridgename containername
docker inspect <first 3 letters of containerid>