-
Clone the Repo
git clone https://github.com/i-dipanshu/python-django-todo-app
-
Install Python and pip for our operating system & confirm the Installation
python --version pip --version
-
Install the dependencies of the application
pip install -r requirement.txt
-
Confirm the Django installation
python -m django --version
-
Migrate the database
python manage.py migrate
-
Start the development server
python manage.py runserver
-
Now the application is accessible on port 8000
http://localhost:8000
-
Install Docker and verify the installation
docker --version
-
We may use the below command to spin up the container using the image created by me
docker run -dp 8000:8000 dipanshu13/django-todo:v1
Now the application is accessible at http://localhost:8000
- Optionally, We may create our image for this application and use it to spin application. It uses the Dockerfile present in the root of the repository. Refer to understand each layer.
docker build -t <image-name>:<tag> .
- Spin the container
docker run -d -p 8000:8000 <image-name>
-
Tag the Image: Before pushing the image, We need to tag it with our Docker Hub username/repo. Replace
username
with our Docker Hub username andimage-name
with the name We want for our repository on Docker Hub.docker tag local-image:tag username/image-name:tag
-
Login to Docker Hub: Before We can push an image to Docker Hub, We need to log in using the
docker login
command.docker login
We'll be prompted to enter our Docker Hub username and password.
-
Push the Image: Once We're logged in, We can push the tagged image to Docker Hub.
docker push username/image-name:tag
-
Check on Docker Hub: After pushing, We can log in to our Docker Hub account through the web interface to see the pushed image in our repository.
Remember that Docker Hub repositories are public by default, so be cautious about pushing sensitive information. If We need private repositories, Docker Hub offers private repository options for paid accounts.
Also, make sure that our Docker image is properly configured and secured before pushing it to a public repository.