# Day 17 Task: Docker Project for DevOps Engineers.

**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.

task:

* Create a Dockerfile for a simple web application (e.g. a Node.js or Python app)
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1688351667175/92f811b3-4ee7-4a7c-94c8-15bb7cbd8a93.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1688351795035/270298a3-4b5d-495f-afc0-5fe3385a99b1.png align="center")
    
* Build the image using the Dockerfile and run the container
    
    Create **Dockerfile**
    
    The first thing we need to do is define from which image we want to build from. Here we will use the python:3.9 image available from the Docker Hub.
    
    ```plaintext
    FROM python:3.9
    ```
    
    Next we create a directory to hold the application code inside the image, this will be the working directory for your application:
    
    ```plaintext
    WORKDIR /app
    ```
    
    Copy your application’s code inside the Docker image folder app using COPY instruction:
    
    ```plaintext
    COPY . /app
    ```
    
    This command installs all the dependencies defined in the requirements.txt file into your application within the container:
    
    ```plaintext
    RUN pip install -r requirements.txt
    ```
    
    This command releases port 8000 within the container, where the Django app will run:
    
    ```plaintext
    EXPOSE 8001
    ```
    
    This command starts the server and runs the application:
    
    ```plaintext
    CMD ["python","manage.py","runserver","0.0.0.0:8000"]
    ```
    
* Verify that the application is working as expected by accessing it in a web browser
    
* Push the image to a public or private repository (e.g. Docker Hub )
