Dockerize Django application | extrovert.dev -->

Dockerize Django application

Dockerize Django application
Tuesday, August 11, 2020
Hey there! I am very excited to write on one of my personal favourites ie: docker. Nowadays there is a huge buzz for docker among the developers because it eased the production of the software we build. For this post, I will be using the music api which was built with Django, Django REST Framework(DRF) in our previous posts.
Dockerize Django application

Why docker?

Docker maintains standardization of the deployment environment. Software today adopting complex configurations with frameworks and architectures. Your deployment environment may be unfriendly due to its mismatch with the dependencies that are well suited to your development machine. Simply a thing that works with Ubuntu may not work with Arch.

Docker vs Virtual Machines

Virtual machines run your software like a separate computer whereas docker shares the host environment. The image below provides a better understanding of docker and virtual machine.
Dockerize Django application
credits: docker

Now let's Dockerize

We need to specify steps to build our image using Dockerfile. It is a simple set of commands organised to perform our building. In your root folder where manage.py exists add this Dockerfile

Now we will run our containerized application using docker-compose. Docker-compose is configured using .yml file

Now run your application using docker-compose up (127.0.0.1:8080). This aggregates all the running containers.

Thank you for reading!



0 Response to Dockerize Django application

Comments are personally moderated by our team. Promotions are not encouraged.

Post a Comment