Docker Compose | Build and start a Django project with Docker Compose & work in a Docker Container

  Рет қаралды 50,238

Very Academy

Very Academy

Күн бұрын

In this Docker compose tutorial we start an application with Docker Compose and run it in a container. I will then show you how to configure a volume to build a mirrored folder from your computer and the container. This way you can develop on your computer but host the application in a container. This is a docker compose tutorial for beginners. Take your first steps with Docker containers.
00:00 Introduction and underpinning knowledge
03:27 Building the Dockerfile
07:00 Docker-Compose File
13:37 Docker Compose Build image
15:17 Docker Compose Run (creating the volume link and new project)
18:00 Docker Compose up (start new container)
Code Repository:
github.com/veryacademy/docker...
Part#2
github.com/veryacademy/YT_Doc...
🐱‍🏍Would you like to SUPPORT US FURTHER so that we can make even more great content - Please consider joining our members community.
/ @veryacademy
👍SUBSCRIBE to get more free tutorials, courses and code snippets!
/ @veryacademy

Пікірлер: 84
@teresa5832ify
@teresa5832ify 2 жыл бұрын
Big thank to this tutorial. I can finally understand every line in both dockerfile and docker compose. Other youtube videos I've watched don't go that detailed and clear. Thank you so much!!
@matheusandrade1059
@matheusandrade1059 6 ай бұрын
you are truly a life savior, you have no idea. Great video, clear and simple explanation thank you so much
@veryacademy
@veryacademy 6 ай бұрын
Glad it helped!
@shaheerzaman620
@shaheerzaman620 3 жыл бұрын
so clear. Complexity simplified. Absolutely fantastic!
@veryacademy
@veryacademy 3 жыл бұрын
Glad it helped!
@catta6449
@catta6449 Жыл бұрын
i've wathced so many tutorials, now i finally understand. sincerely, many many thanks to you.
@AshisRaj
@AshisRaj 2 жыл бұрын
Excellent job buddy. You have cleared all my doubts. Thank you so much.
@jmpersic
@jmpersic 2 жыл бұрын
Best tutorial I've found so far.
@LifeOf97
@LifeOf97 2 жыл бұрын
This is really easy to understand, thanks Very Academy.
@shreyashsrivastava5467
@shreyashsrivastava5467 3 жыл бұрын
I requested for this like just last day and you uploaded it today. Thank you so much ❤️
@veryacademy
@veryacademy 3 жыл бұрын
No problems, sorry I may have said it was tutorial 3 - this way seems a little more logical.
@mohankrishna1443
@mohankrishna1443 6 ай бұрын
This is just awesome
@romainbey
@romainbey 3 жыл бұрын
Thanks for sharing this. Very good explanation.
@dodokwak
@dodokwak 2 жыл бұрын
Yes, it was very useful. Thanks again.
@CristianGomez-vc8pk
@CristianGomez-vc8pk 3 жыл бұрын
wonderful tutorial thank you so much
@felixfigueroa
@felixfigueroa 3 жыл бұрын
Clean and direct content, very focused, good job..!
@veryacademy
@veryacademy 3 жыл бұрын
Hi Felix, thanks for the support. Glad the content is of some use to you! 👍
@RABWA333
@RABWA333 2 жыл бұрын
Thank you very much , its very informative , helpful
@md.moktarali1493
@md.moktarali1493 2 жыл бұрын
Really nice tutorial, thanks a lot
@arturkabitcher
@arturkabitcher 2 жыл бұрын
Awesome stuff, thanks a lot.
@akhillshetty2140
@akhillshetty2140 3 жыл бұрын
You're doing a great job, Zander!
@veryacademy
@veryacademy 3 жыл бұрын
I try - this is just one of those - no one has really made tutorials 👍
@TheAlibigdeli
@TheAlibigdeli 3 жыл бұрын
thank you for your awesome tutorials around the django framework
@veryacademy
@veryacademy 3 жыл бұрын
You are welcome!
@mediatwinkleTV
@mediatwinkleTV 3 жыл бұрын
Sir, you are really really good at teaching. I mean really good. Of all the youtube videos I watch (and I watch a lot), you're in my top 3 youtuber on tech tools ! Thank you sir !
@veryacademy
@veryacademy 3 жыл бұрын
Thank you kindly! Who is the other 2?
@archienemigo
@archienemigo Жыл бұрын
lov ya man you nailed it
@yashasbharadwaj4721
@yashasbharadwaj4721 3 жыл бұрын
tq so much sir really amazing
@bumblebee2012able
@bumblebee2012able 3 жыл бұрын
Thanks from Vietnam, amazing as always
@veryacademy
@veryacademy 3 жыл бұрын
No problems! 👍
@mohankrishna1443
@mohankrishna1443 6 ай бұрын
🙇 I bow my head sir! this Tutorial helped me a lot.
@veryacademy
@veryacademy 6 ай бұрын
Thank you.
@Morgan035
@Morgan035 Жыл бұрын
Thanks you very helpful
@veryacademy
@veryacademy Жыл бұрын
You're welcome!
@rawannassan8162
@rawannassan8162 3 жыл бұрын
Great, Thank you sooo much
@veryacademy
@veryacademy 3 жыл бұрын
You're most welcome
@KuriakoseKuruvilaAnathanam
@KuriakoseKuruvilaAnathanam 6 ай бұрын
Incredibly informative tutorial.
@veryacademy
@veryacademy 6 ай бұрын
Glad you liked it
@txcing9296
@txcing9296 2 жыл бұрын
you are amazing. thank you so much
@veryacademy
@veryacademy 2 жыл бұрын
Thank you 🙏
@berkefekeskin9172
@berkefekeskin9172 Ай бұрын
i love docker
@hassanelabdallah5013
@hassanelabdallah5013 3 жыл бұрын
best teacher ever👌🏻😉
@veryacademy
@veryacademy 3 жыл бұрын
Thank you! 😃
@AndreBeeDXB
@AndreBeeDXB 3 жыл бұрын
Hi and thanks a lot for yet another amazing tutorial! One question if I might, why are we specifying the command to create a new Django "core" App on the CLI with the docker-compose run command and we are not placing it in the command: line inside the docker-compose.yml file? Couldn't we chain this command and the run server command there and avoid passing it manually? Thanks!
@GoziePO
@GoziePO 10 ай бұрын
i had the issue where $docker-compose run --rm app django-admin startproject core . didn't work to create a core folder! I fixed it by changing the working directory in the docker file from /app to /django. You have to delete the container image in docker before trying the command again! hope this helps.
@khuramjaved450
@khuramjaved450 2 жыл бұрын
Hi, Thank you so much for the such complete explantory video. I have run the app successfully but facing another issue. When ever I try to use a class from Django or DRF, vscode can't auto import or show the option to import that class from django/drf module. This is really annoying after setting up the project. Kindly create a video on this issue or if there is already a video please send the link Thanks :-)
@naheliegend5222
@naheliegend5222 3 жыл бұрын
Thank you. Can you do videos about deploy to production?
@veryacademy
@veryacademy 3 жыл бұрын
I keep saying I will but not delivered yet, I definitely will do! I will find time for it soon! Promise!
@naheliegend5222
@naheliegend5222 3 жыл бұрын
@@veryacademy appreciate it a lot
@imranshaikh6224
@imranshaikh6224 2 жыл бұрын
Awesome sir, but my question is how to run multiple commands for existing project like makemigrations, migrate, runserver for existing project please answer
@MrHasenboerga
@MrHasenboerga 6 ай бұрын
Hi, thanks a lot for this tutorial! You explain it in a great way. There is one point I did't get. Why should I run the "docker-compose run --rm app django-admin startproject core." command? Why not without docker-compose like in Part 1? The content of the folder will by copied to the container anyway, isn' it?
@veryacademy
@veryacademy 6 ай бұрын
Let me know if this doesn't make sense. The docker-compose run --rm app django-admin startproject core. command is used with Docker Compose to run a one-off command inside a service. This command is specifically designed for situations where you want to run a command in a Docker container defined in your docker-compose.yml file. The purpose of using docker-compose run in this context is to ensure that the command (django-admin startproject core.) is executed within the context of your Docker container. This ensures that the project structure and files created by the startproject command are within the Docker container and not on your local machine. If you were to run the django-admin startproject core. command directly on your local machine without docker-compose, the project structure and files would be created on your local machine, outside the Docker container. This might lead to compatibility issues, especially if your development environment relies on dependencies, configurations, or tools that are specific to the Docker container. By using docker-compose run --rm app, you explicitly specify the service (app in this case) where the command should be executed. The --rm flag ensures that the container is removed after the command completes.
@MrHasenboerga
@MrHasenboerga 6 ай бұрын
Thanks a lot for that very detailed answer. I’m quite new to Django and Docker. Your answers makes totally sense if I imagine that the django-admin command does slightly different things, if I runs inside or outside the container.
@gflorin7761
@gflorin7761 Жыл бұрын
Hi! Do you still need to "COPY requirements.txt requirements.txt" if the "." directory is already mounted on "/django" on the container?
@cje8887
@cje8887 3 жыл бұрын
I have the same problem as some others in this comment section: when i run `docker-compose run --rm app django-admin startproject core .` the django project doesn't get created. I am on MacOS and have tried it both with and without venv. EDIT: I had not saved some files in VSCode. Once I did file => save all and ran build and run again, it worked.
@veryacademy
@veryacademy 3 жыл бұрын
👍
@brunomachado8571
@brunomachado8571 2 жыл бұрын
Hey Mate, best tutorials ever I might say. But I do get "Run a one-off command on a service." when running docker-compose build. It doesn´t create core . Any ideias why? thanks
@GoziePO
@GoziePO 10 ай бұрын
i had the same issue but fixed it by changing the working directory in the docer file from /app to /django. You have to delete the container image in docker before trying the command again! hope this helps.
@bien-aimedimitri6450
@bien-aimedimitri6450 Жыл бұрын
Hi, my core app have the root permission how can i fix that
@CookingInvitation
@CookingInvitation 3 жыл бұрын
I love your docker series and others, but I have a problem, I hope you can guide us on that as well. I am new to Docker, checked some tutorials for the understanding, but unfortunatelly I am not understanding one thing and that is: 1- How to use the Docker image with the prespective of development? I understand that we can make the docker image and push that to docker-hub repository, but don’t what to do after that. I pulled the docker image from docker-hub which I pushed. At this point I am missing what can I do with this image and how to do that? For Example: 1- Created a Django app 2- Created a Dockerfile 3- Created the docker-compose.yml file 4- Build the docker image with “docker-compose build” (on Windows 10) 5- Ran the image with “docker-compose up”. 6- Up until this point, everything went well and I can access the application from my browser. 7- Then I pushed this image to docker-hub and I can see the pushed image on the repository. 8- At this point I pulled the code at another machine that is running Ubuntu 20.04 and tried to run the docker. (no output) 9- Now I am confused here, what should I do with this docker image which I pulled from docker-hub? Where is my source code of Django App? How can I work etc. I am new to docker, please help. Thanks.
@veryacademy
@veryacademy 3 жыл бұрын
Will answer in the morning 👍
@muhammad-bilal1
@muhammad-bilal1 3 жыл бұрын
@@veryacademy waiting for your kind attention please.
@rayon9353
@rayon9353 2 жыл бұрын
@@veryacademy where did you answer this kind sir?
@Conormcnproductions
@Conormcnproductions Жыл бұрын
is it possible to avoid using runserver on windows? what if you use WSL and download a linux app on windows, then you could download uswgi and other libraries that aren't available on windows. I don't understand enough to know what's possible on windows or what limitations there are
@fahadmdkamal530
@fahadmdkamal530 2 жыл бұрын
Cannot add or modify files of the generated file using linux ubuntu. It says: permission denied
@bastianjohannesen1066
@bastianjohannesen1066 11 ай бұрын
Hi Which wsgi module is best suited for windows? I understand that uwsgi doesn't work?
@veryacademy
@veryacademy 11 ай бұрын
Thanks for asking. I can’t help you there.
@gouravbansal994
@gouravbansal994 3 жыл бұрын
Are you using WSL2 in windows to run docker?
@veryacademy
@veryacademy 3 жыл бұрын
Yes 👍
@mitmc6758
@mitmc6758 3 жыл бұрын
Thank you for good lesson. As I follow your lecture, I have some trouble with starting a django project. I can't see the "core" forlder created after the following command. I also don't see any error message. [docker-compose run --rm app django-admin startproject core . ] Could you give me some advice on that?
@ayeshrodrigo2197
@ayeshrodrigo2197 3 жыл бұрын
the new app "core" does not generate after running the command "docker-compose run ---rm app django-admin startproject core .". Any idea for the reason?
@veryacademy
@veryacademy 3 жыл бұрын
If you can paste in your docker file and docker compose file I will take a look
@ayeshrodrigo2197
@ayeshrodrigo2197 3 жыл бұрын
​@@veryacademy Found it. Seems it causes because my project was on a removable drive and it seems to require the project to be on the hard drive. Not sure why though, but it worked when the files moved to the hard drive folder and then run after a docker prune.
@veryacademy
@veryacademy 3 жыл бұрын
You would need to look into for example using a bind mount directly in your service declaration I would presume. It simply cant find the drive.
@codewithfarhad8594
@codewithfarhad8594 Жыл бұрын
to all those getting no file generated after running docker compose run, this is because the Dockerfile specifies working directory to be "/app" whereas, docker-compose.yml file specifies the working dir to be "/django". so it does not work. the easy fix is to edit your docker-compose.yml file and change the volume to mount in /app dir: - .:/app
@rajanbhamdari4903
@rajanbhamdari4903 Жыл бұрын
both "core . " and " core " doesnot make project what should i do . . terminal run successfully but doesn't make folder ..
@veryacademy
@veryacademy Жыл бұрын
What line of code are you expecting it to make a new folder?
@julienboudreau6847
@julienboudreau6847 2 жыл бұрын
There appears to be an issue - when using django-compose run --rm django-admin startproject core . nothing happens. It does not create a django project. A few other commenters have had the same issue. Are you running in a venv? From your CLI, it doesn't seem to be the case.
@uzotammy
@uzotammy Жыл бұрын
I have the same problem. Would anyone be able to help?
@supritkumar2624
@supritkumar2624 Жыл бұрын
Only Content . Non other things
@maulanaajiw6184
@maulanaajiw6184 Жыл бұрын
this tutorial doesn't help, because after i stop the server and will restart it, it doesn't work normally like the beginning of the video
@maulanaajiw6184
@maulanaajiw6184 Жыл бұрын
then after I repeated the "docker-compose up" method, the only thing that worked was the database container while the django container couldn't.
@maulanaajiw6184
@maulanaajiw6184 Жыл бұрын
then i also tried to run the django container with the command "docker container start" it also didn't work
@walkerstark9584
@walkerstark9584 Жыл бұрын
i subscribe
Introduction to CASADI for Beginners [lecture 2]
50:06
Mohammad alshikh khalil
Рет қаралды 9
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 30 МЛН
Comfortable 🤣 #comedy #funny
00:34
Micky Makeover
Рет қаралды 9 МЛН
Docker | How to Dockerize a Django application (Beginners Guide)
20:08
Using docker in unusual ways
12:58
Dreams of Code
Рет қаралды 429 М.
Docker | Towards serving React (Nginx) with Django API (gunicorn)
48:35
The Story of Next.js
12:13
uidotdev
Рет қаралды 560 М.
API vs. SDK: What's the difference?
9:21
IBM Technology
Рет қаралды 1,4 МЛН
Prepare a Django app for Deployment using Docker
39:10
London App Developer
Рет қаралды 88 М.
Ultimate Docker Compose Tutorial
1:03:14
TechWorld with Nana
Рет қаралды 158 М.