Day 17 Task: Docker Project for DevOps Engineers.

Day 17 Task: Docker Project for DevOps Engineers.

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.

For more about Dockerfile visit?here

task:

  • Create a Dockerfile for a simple web application (e.g. a Node.js or Python app)

vi Dockerfile to create a Dockerfile and then enter the commands


FROM python:3
RUN pip install django==3.2

COPY . .

RUN python manage.py migrate

CMD ["python","manage.py","runserver","0.0.0.0:8001"]
        

  • Build the image using the Dockerfile and run the container


sudo docker build . -t todo-app 
( -t to give a tag name)

sudo docker run -d -p 8001:8001 865efc65ac7c 
(-d to run it in background as daemon task)
(-p for mapping port 8001:8001 on build no 865efc65ac7c)
        

  • Verify that the application is working as expected by accessing it in a web browser

No alt text provided for this image


  • Push the image to a public or private repository (e.g. Docker Hub )


 sudo docker push todo-app
        

For Reference Project visit?here

If you want to dive further, Watch?bootcamp

Happy Learning:)

#aws #docker #dockercontainer #dockerfile #dockerimage

要查看或添加评论,请登录

Manish Negi的更多文章

  • Day 19 Task: Docker for DevOps Engineers

    Day 19 Task: Docker for DevOps Engineers

    Day 19 Task: Docker for DevOps Engineers Till now you have learned how to create docker-compose.yml file and pushed it…

  • Day 18 Task: Docker for DevOps Engineers

    Day 18 Task: Docker for DevOps Engineers

    Day 18 Task: Docker for DevOps Engineers Till created Docker file and pushed it to the Repository. Let's move forward…

  • Day 16 Task: Docker for DevOps Engineers.

    Day 16 Task: Docker for DevOps Engineers.

    Day 16 Task: Docker for DevOps Engineers. Docker Docker is a software platform that allows you to build, test, and…

  • Day 15 Task: Python Libraries for DevOps

    Day 15 Task: Python Libraries for DevOps

    Day 15 Task: Python Libraries for DevOps Tasks Create a Dictionary in Python and write it to a json File. import…

  • Day 14: Task: Python Data Types and Data Structures for DevOps

    Day 14: Task: Python Data Types and Data Structures for DevOps

    Data Types Data types are the classification or categorization of data items. It represents the kind of value that…

  • PythonDSA: Data types

    PythonDSA: Data types

    **What is Python?** - Python is Open source, general purpose, high-level, and object-oriented programming language. -…

    1 条评论
  • Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2

    Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2

    Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2 Git Stash: Git stash is a command that allows you to…

  • Day 10 Task: Advance Git & GitHub for DevOps Engineers.

    Day 10 Task: Advance Git & GitHub for DevOps Engineers.

    Day 10 Task: Advance Git & GitHub for DevOps Engineers. Git Branching Use a branch to isolate development work without…

    1 条评论
  • Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers.

    Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers.

    # Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers ## Find the answers by your understandings(Shoulden't be…

  • Day 8 Task: Basic Git & GitHub for DevOps Engineers.

    Day 8 Task: Basic Git & GitHub for DevOps Engineers.

    # Day 8 Task: Basic Git & GitHub for DevOps Engineers guided by Shubham Londhe ## What is Git? Git is a version control…

社区洞察

其他会员也浏览了