10 Basic commands for Docker

10 Basic commands for Docker

What is Docker?

Docker is a open source platform for developing , shipping and running your application. It helps you to separate your application from your infrastructure so that you can deliver you application quickly. By using docker you can reduce time between writing the code and running it into production. With docker you can package and run your application in a isolated environment called container. Isolation of containers allow you to run multiple containers on a host machine simultaneously .

What is Containerization ?

Containerization is type of operating system virtualization through which applications can run on isolated environments called containers, which share resources from base operating system.

What is Docker Image ?

A Docker image is a read-only template that contains a set of instructions for creating a container that can run on the Docker platform. It provides a convenient way to package up applications and preconfigured server environments, which you can use for your own private use or share publicly with other Docker users.

Docker images are also the starting point for anyone using Docker for the first time.

In this article I am going you to tell you 10 docker commands.

1.

docker --version

This command is used to check the current version of the docker installed in your system.

Screenshot from 2020-11-25 18-03-57.png

2.

docker pull <image-name>

This command is used to pull (download) images from the docker hub into your system.

Screenshot from 2020-11-25 18-16-34.png

3.

docker images

This command will show all the docker images present in your system.

Screenshot from 2020-11-25 18-19-07.png

4.

docker ps

This command is used to display all the running containers.

Screenshot .png

5.

docker run <image-name>

This command is used to run container from the locally stored images. If the image is not present locally it will pull the image first then run the container.

Screenshot from 2020-11-25 18-27-03.png

6.

docker inspect <image-name>

This command will return returns detailed, low-level information on Docker object.Here you can enter image id by using docker image command.

Screenshot from 2020-11-25 18-34-43.png

7.

docker search <image-name>

This command is used to search Docker Hub for the images.

Screenshot from 2020-11-25 18-47-24.png

8.

docker stop <container-id>

This command is used to stop the running container.

Screenshot .png

9.

docker start <container-id>

This command is used to start a container which has already been created.

Screenshot from 2020-11-25 19-01-36.png

10.

docker run <container-id>

This command is used to delete the container if it is not running.

Screenshot from 2020-11-25 19-05-06.png