Day17 of #90daysofdevops | Dockerfile and creating container

Day17 of #90daysofdevops | Dockerfile and creating container

ยท

2 min read

Table of contents

Dockerfile

Docker is a tool that makes it easy to run applications in containers. Containers are like small packages that hold everything an application needs to run. To create these containers, developers use something called a Dockerfile.

A Dockerfile is like a set of instructions for making a container. It tells Docker what base image to use, what commands to run, and what files to include. For example, if you were making a container for a website, the Dockerfile might tell Docker to use an official web server image, copy the files for your website into the container, and start the web server when the container starts.

Commands

Here in the below image we are operating as a superuser and will update the system. Also checking if docker is running on the system or not.

We are now creating a new container namely rahulcontainer with the Ubuntu image we pulled from the docker hub. Now we will go to the tmp directory within the newly created container and make file rahulfile1 and then compare the container before and after by docker diff<container name> command.

Now we will make another container with the same image and will name it rahulcontainer2 and from the image we can see the content from temp has been created/copied too.

The below snapshot shows how we can build a container from a Dockerfile. And we will name it testcontainer and can see the content that we put in Dockerfile.

Thanks for reading the blog & do share them with someone in need :)

Please share your views and suggestions, they are always welcome.

See you then in the next blog.

Happy learning :)

ย