Docker Container Part-1.

Arpita Srivastava
EduTorq Community
Published in
3 min readAug 13, 2020

--

But before we jump to containers first we will learn about the Image in docker (images here doesn’t represent any pictorial form). To learn about Why we need Docker, here is the blog I have written.

Docker Image.

A Docker image is a file, that have multiple layers, which is used to execute code in a Docker container.It provides a convenient way to package up applications and pre-configure server environments, which you can use for your own private use or share publicly with other Docker users.

Docker for Windows: https://download.docker.com/win/stable/Docker%20Desktop%20Installer.exe

Docker for Linux: https://runnable.com/docker/install-docker-on-linux

After you install the Docker on your machine, we will see how to pull (download) the image from docker.

To check the images already present in your machine, use this command:

 docker images

You see currently no images are present. So we will now pull the Ubuntu image. “docker pull” is the command, “ubuntu” is the image name seperated by colon(:) with latest version or you can update with the particular version. First it look for the image locally and then it will pull from the docker repository called Docker Hub.

docker pull ubuntu:latest

Now again run the “docker images” command. You will see a ubuntu image is now present.

Now if you want to remove or delete the image, use this command:

docker rmi <IMAGE ID> 

We will use this image to run the container. If we want to run the container we will definitely need the image. So now don’t delete it.

To check if there is any container running, use this command:

docker ps

To run the container, use this command:

docker container run -itd <Image ID>

To remove or delete the container, we will first stop the container and then remove it.

docker container stop <Container Id>
docker container rm <Container Id>

In this blog we had some glimpse about container. Here Docker Container Part-2,where I have discussed more about container and the options we had passed while running the container and bonus interview questions also.

That all for now, hope this will be helpful for you.If you like this please give some claps it motivates me to write more.

--

--