How to do containerization?
Steps to create and run image and container on Docker
Create an EC2 instance on AWS (optional)
Install docker on your machine
>sudo apt-get update
>sudo apt-get install docker.io
Add user into the docker group to perform required actions
\>sudo usermod -aG docker $USER
Reboot your machine to apply the changes
\>sudo reboot
Clone the git repository
\>git clone repository_URL
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.
Now build the Docker image using Dockerfile
>docker build . -t react-django-app:latest
To check whether the image has been created or not, use the below command.
>docker images
To create a container from the above image, use the below command.
\> docker run -d -p 8001:8001 react-django-app:latest
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