Docker Commands For Beginner

I am a DevOps learner.
Introduction to docker
Docker is an open platform that uses OS-level virtualization to deliver software in packages called containers. These containers are isolated from one another and use a single operating system kernel. The Best thing about these containers is they use fewer resources than a virtual machine. The Docker tool is useful in deploying, shipping and testing your applications. The Docker daemon is responsible for managing these containers. And Docker CLI (command line) helps us to communicate with the docker daemon. You can read the docker's official documentation page to learn more about docker. Here is the link to the page
๐ "https://docs.docker.com/get-started/overview/".
Docker Commands
Below is the list of docker commands that are useful for beginners. I have given a short description of each command.
docker versionThis command will let you know the docker version installed on your Operating system.
docker pulldocker pull [image name][:tag name]This command is used to pull the image from the docker hub repository. Type the
docker pullcommand followed by the image name. Then followed by the tag name to mention the version of the image. By default, the latest tag is used in case you don't mention the tag name.docker rundocker run [options] image [command] [argument]This command is used to run the container using the image provided. followed by the container name and some of the arguments to pass after the container starts. for example:
docker run --name myubuntu -it ubuntuThis will create an ubuntu container named myubuntu using the provided image name. Here the
-itis used to open the terminal of the container after it starts.docker psdocker ps [options]This command is used to list all the running containers in the background. You can use
-aoption to get the list of all the containers running, stopped or exited.docker imagesThis command is used to list all the images downloaded on the system.
docker stopdocker stop [container name or ID]This command is used to stop the running container. Type the
docker stopcommand followed by the container name or container ID.Note: Every container gets a unique Id number after we create it.
docker rmdocker rm [container name or ID]This command is used to remove the container. Type the
docker rmcommand followed by container name or Id.Note: You should stop the container before you remove it or use
--forceoption along with thermcommand to remove it.docker rm --force myubuntudocker logsdocker logs [container name or Id]This command is used to check the logs of all the docker containers with the corresponding contained id mentioned in the command.
docker rmidocker rmi [Image name or Id]This command is used to remove the image. Type the
docker rmicommand followed by the image name or Id.docker createdocker create [container name] image nameThis command is a combination of pull and run commands. Type
docker createcommand followed by--namecommand to provide a container name and then followed by the image name you want to use. for example:docker create --name myubuntu ubuntu.
I hope these commands may help you to begin with docker. Thank you
