Pulling the first Docker image and a few essential commands.

Mohamed Rifkhan
3 min readFeb 22, 2022

Today we will take a look at our first docker image and take a look at a few important docker commands that you need to know in order to navigate this docker journey.

Before we begin, you should check out the previous post for this series if you do not know the docker, and it is an installation process.

Hello Worldis our favorite message when it comes to getting started. Isn’t it?

So today, we will pull the Hello World docker image from the Docker Hub and run it. But first things first, What is a Docker Hub?

However, Docker Hub is a collection of Docker images created by organizations (e.g. NodeJS, MongoDB, oracle) or by individual developers. Images in Docker Hub are ready for use. Someone has already configured them for you. You need to pull or download them to use.

Pull Command

Pull command downloads the docker image from the docker hub. That’s it.

$ docker pull hello-world

Run Command

Run command used to run docker images that are pulled from the docker hub or build on the local machine. One more thing, Run command first looks for images to run locally, and if it doesn't find the image, it will automatically pull the image for you. So in case you are a bit lazy to pull and run an image. Just type the run command, and it will help you.

$ docker run hello-world

You will see something like this if you successfully ran the command.

Few more basic commands you need to know.

version command used to check the version of the docker.

$ docker version

info command gives you current status like the number of the running containers, paused, stopped, and all other things.

$ docker info

ps command will specifically tell you the information about running containers like container id, name, port, status, etc.

$ docker ps

-all flag will show you information about all containers.

$ docker ps -all

start command will start previously ran container again. Don't confuse between run and start. Run command used to run a new container.

$ docker start <process> 

stop command will stop the running container as soon as a container finished its process.

$ docker stop <process>

kill command will stop the container immediately, no matter if it finished its process or not.

$ docker kill <process>

Now, docker has a lot of commands that we will learn in the future, but I think these are the essential ones. I hope this will help you. I will back with other things about docker until then, Bye.

--

--

Mohamed Rifkhan

💻 DevOps Engineer | 🎓 Bsc in Network System Engineering | 🚀 Always learning and pushing boundaries