Docker is a set of the platform as service products that use OS-level virtualization to deliver software in packages called containers(namespace). here, we are dockerizing a simple user login and sign up Django project. The project we are using too dockerized is Sign Up and log in
To download source code use
$ git clone https://github.com/itsvinayak/user_login_and_register.git
The next step is to add Docker to it. So, create an empty file named Dockerfile and put this code inside it
$ touch Dockerfile
now edit it.
FROM python:3.6 RUN apt-get update \ && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app COPY requirements.txt ./ RUN pip install -r requirements.txt COPY . . EXPOSE 8000 CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
Now we need to build our Docker image and run it. This can be done by the following command :
to build image
$ sudo docker build -t image_name .
to see if image exit use and you can see all your images.
$ sudo docker images
to run docker application use
$ sudo docker run -p 8000:8000 image_name
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Introduction to Xamarin | A Software for Mobile App Development and App Creation
- Deploying Your Web App using Azure App Service
- Progressive Web App - A Combination of Native and Web App
- How Mobile App Testing Can Boost Chances of an App Success?
- How to Publish Your Android App on Amazon App Store for Free?
- Python | Creating a Simple Drawing App in kivy
- How to build a simple Calculator app using Android Studio?
- How to build a simple music player app using Android Studio
- Python | Django News App
- Weather app using Django | Python
- Django App Model - Python manage.py makemigrations command
- How to Create an App in Django ?
- Django Basic App Model - Makemigrations and Migrate
- Connect Django Project to MongoDB using Django
- Styling Django Forms with django-crispy-forms
- Adding Tags Using Django-Taggit in Django Project
- Deploy Python Flask App on Heroku
- Why Kotlin will replace Java for Android App Development
- App Development for Android in 2017: Challenges and Solutions
- Which language should you learn first if you want to make an app?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.