React-Django App

React-Django App

Dockerize a React-Django App project

How to do containerization?

Steps to create and run image and container on Docker

  1. Create an EC2 instance on AWS (optional)

  2. Install docker on your machine
    >sudo apt-get update

    >sudo apt-get install docker.io

  3. Add user into the docker group to perform required actions

    \>sudo usermod -aG docker $USER

  4. Reboot your machine to apply the changes

    \>sudo reboot

  5. Clone the git repository

    \>git clone repository_URL

  6. Now write a Docker file for the Python Django app.

    >vim Dockerfile

    Key points for creating a Dockerfile are:

    • Check the README.md file to understand the project's tools and requirements.

    • Check the requirements or pom file for required libraries.

    • Use the RUN instruction when you need to execute any command during image creation.

    • Use the CMD instruction for container commands.

      1. Now build the Docker image using Dockerfile

        >docker build . -t react-django-app:latest

      2. To check whether the image has been created or not, use the below command.

        >docker images

      3. To create a container from the above image, use the below command.

        \> docker run -d -p 8001:8001 react-django-app:latest

      4. To check the docker logs use attach command

        \>docker attach container_id

        Git repo:- https://github.com/LondheShubham153/react_django_demo_app.git
        Docker repo url:-
        https://hub.docker.com/repositories/ayshkatheria