Getting Started with Docker 2024 | What is Docker | Part- I

Photo by Ian Taylor on Unsplash

Getting Started with Docker 2024 | What is Docker | Part- I

What is Docker?

Docker is a platform that packages an application and its all dependencies in the form of containers OR Docker is a platform for building, running and shipping applications in a consistent manner. if your application runs your development machine so it can also run the same way on other machines.

How to Install Docker Desktop Window, Mac and Linux?

You can check Docker Website and download it as per your system requirements you can see the following image at the yellow sign.

What is Docker Container?

This is an isolated environment for running an application. We can say running instances of Docker image and we can run multiple containers from 1 image. Check all running docker containers using the docker ps command on your Terminal.

What is Docker Images?

A Docker Image is a set of instructions that we need to build a container. It Includes App source code, but also complete environment configuration. Check all docker images using the docker images command on your Terminal. you can see image TAG, Image ID, CREATED and SIZE.

How do we get Docker Images?

Let's suppose you want to run a database container like MongoDB, SQL, PostgreSQL whatever so where can we find these images that's where came Docker Registries A storage and distribution system for docker images.

Note- Official images are always maintained by the software authors or in collaboration with Docker Community.

Docker hosts one of the biggest Docker Registry, called Docker Hub.

How do we get Docker Images locally?

To download any docker images locally we have to use the docker pull <image name> command. In this case, I am downloading a hello-world image from the docker hub. you can download with a specific version also using this command docker pull <img name:version> or docker pull nginx:1.23

How do we run an image in a container environment?

I have pulled nginx image to do this using the following command

  • docker pull nginx

  • docker run -d nginx

  • To check all the running container docker ps

Note: It is not necessary to first we have to pull the image and then run. we can run it directly it will automatically pull images from the docker hub

You can open your Docker Desktop as well and check the all container in the status section you can see it is running.

How to Start and Stop Containers?

Whenever we use docker run -d <image name> It will always create and run a new container. You can see two handy commands in the following image to start and stop a container.

What is Dockerfile?

Dockerfile- Build instruction, This is a text document that contains commands to assemble an image. Then docker will able to read those instructions and build an image.

Did you find this article valuable?

Support Shivam Sharma by becoming a sponsor. Any amount is appreciated!