What is a Docker file?

Published by halahal.in on

A Docker file is something significant in the entire process of SDL (Software Development Lifecycle), It is a file created to make the Docker image of software or an application, whose running instance called Docker container runs on production servers. To know more about Docker, please read the earlier articles.


Basis of a Software in the Developers System

  • Any software contains a few components
1.     Code.

2.    Libraries of Language {In which the code is written}.
 
3.    Dependencies for the Code.

4.   Framework for the coding Language.

5.   Configuration files.

6.   Any few more.

This is usually present in the developer’s system/laptop, allowing them to code and run the software in their system successfully. This usually never happens when the same code is copied in a different system because the other systems might get the code but that system may not have the other dependencies or the libraries which are necessary to run the software or application. “That is the reason why the developer’s team says “It runs in my system and not in yours” error.

When we write the docker file we usually mention the base image which helps the software to run in an environment. Thereafter we copy the code into the file along with the commands that help install the framework, dependencies, and libraries into the docker file. Thereafter we expose the port on the container where it will listen to the traffic, the final command is presented to run the docker file.

A Sample Docker File

The above image is the sample Docker file that explains what goes inside a Docker file. When we run the docker build command. It sends the signal to the docker daemon to start building the docker image that will package everything required for that software to run on any machine, irrespective of the configurations.

docker build -t python_app .

The docker daemon reads the docker file in the folder and starts building the docker image by reading the docker file.

Once the docker image is built it stores the docker image in the local docker repository which can be viewed by running the command

docker images

The docker images can be uploaded to the remote repository so that it can be accessed from anywhere. A docker container is an instance of a docker image that runs as an application on the server.

Categories: DevOps

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *