How To Use Docker To Make Local Development A Breeze

preview_player
Показать описание
Docker is a very powerful tool for developing applications that run in the cloud. If you want to get the most out of it, you need to make sure that the way you're running your code locally matches as closely as possible with how it runs in the cloud.

🎓 Courses:

Check out @codeSTACKr and @JackHerrington's channel I mentioned in the video here:

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

👀 Code reviewers:
- Yoriz
- Ryan Laursen
- James Dooley
- Dale Hagglund

🔖 Chapters:
0:00 Intro
1:04 Explaining the code example
3:22 Running the server locally (without Docker)
5:05 Docker & cloud deployment
6:45 Issues with running code in your local development environment directly
8:01 Building and running a Docker container locally
14:40 Docker-compose introduction
15:54 Docker-compose YAML file example
19:32 Dealing with changes in the data

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!
Рекомендации по теме
Комментарии
Автор

I think it was brilliant to mention the ordering of commands in the dockerfile. It took me years to realize that ordering is the key to leveraging the build cache. Thank you!

heliophobicdude
Автор

i was avoiding docker for practically years now, but your great example here made me try it out now - thank you! Not only did it work in a day, it forced me to get a much cleaner base setup for my (old and "naturally grown") project. This injected a whole lot new joy - and a lot of possibilities.

GeorgMayer
Автор

This is one of the best videos i've seen in a very long time. You so clearly explain this pipeline, anyone can pick it up. Here I am manually rebuilding docker containers every time I change code.

nickheyer
Автор

Thanks Arjan, this is an awesome video! The format really helps me understand why we need docker and docker-compose. Also the tip of putting the install dependencies command before copying project folder is so important. Keep it up man!

wanderer
Автор

I have been working on exactly this (Making our FastAPI backend services available to our front-end devs locally through docker compose) at work for the past 2 weeks or so, where's the camera? :D Only difference was that I use poetry to install requirements, maybe a tool worth to explain in a video as well in the future? Love your content ☺️

veni_vidi_victorian
Автор

This is a seriously well done explanation not only of Docker, but of good development environment setup in general. I'm working to get my team more in sync with these kinds of practices.

tothestars
Автор

I'm actually new to python but i love your way of teaching. There are some aspects that I don't understand but will learn as I start practicing.

athakur
Автор

The best comprehensive video which explains the whole process really well. Thanks a ton

official.mhm
Автор

Your content is always so clear to understand and does a great job taking a learner through a journey that is easy to follow!

MichaelPayPlus
Автор

I have never seen someone explain Docker this simple and clear. I would've understood Docker after watching this video even if I was 5.

codemyown
Автор

I've been developing software for 20+ years and always used virtual environments for Python - I feel really behind the curve here, but have been curious about utilizing containers and watched a number of videos. Yours is easily the most clear, concise, and logically understood tutorial I could find. I had previously tried Patrick Loebers tutorial but found he had missed a number of critical steps and made a non-trivial amount of formatting errors.

So thanks for this tutorial, much appreciated!

christsciple
Автор

Love this. Very easy to follow, and a simple yet viable example which does not look like everyone else's copy/paste examples that are out there. Someone else mentioned a video on deployment - would like to put in a vote for that as well. I've done Docker and docker-compose for a long time, but the deployment aspect still eludes me. Obviously, there are nuances between cloud providers (Azure/AWS/GCP), but a simple example using one of them would be awesome if you could put it together. Thanks

SkipperChuck
Автор

So far one the most detailed videos about docker. I've seen like more than 15 videos about docker but none of them mentioned the point that you pointed at 11:00. Please carry on posting, for someone like me who likes to learn these stuff these videos are very informative.

benyaminaghaebrahimi
Автор

I have few minor comments on this one, mainly because I'm working mostly with docker day-to-day:
- use multi-stage builds, this example may not show it but docker images' size gets really blown out when you create many layers on them, in this example you could f.e. use venv in first part of the build (or poetry, tbh I recommend it as a package manager it blows the pip from earth) and then copy the venv to the second, much lighter image (f.e. python alpine)
- I'd recommend to not use the latest image unless you're running some testing for building docker images, I've met some situations when something changed between let's say python3.6->3.9 and the docker image would be non functional
- docker-compose for volume append only was a overkill, however I agree on the need of docker-compose files, they unify the work in the team. While using python with poetry you can also use the PoeThePoet for managing simple jobs as building docker image and then docker-compose up if you're making crucial changes in the code itself
- I'd look into docker-slim after the two-stage images, Your image is probably ~800-900 MB, two stage build with alpine-python or python:slim would make it go to ~100-150MB and after docker slim you could be left with at most 50MB. I know that developers don't really care about that, but imagine having 10-15 images of yours size, that's 15GB of disk wasted
- and the last thing, I'd recommend building with Kaniko (tool from google) instead of docker build, it's faster, produces slightly lighter images and has better caching at least in my experience

jonaszasut
Автор

It would be good to specify Dockerignore file as well, for example if you don't want to copy venv/ folder or precompiled python code (__pycache__ etc) into container (keep it small)

hncyeel
Автор

You are a f'ing amazing teacher. Most clear video of this topic on YouTube by far. Subscribed!

sixpooltube
Автор

שידור ממש מעניין! תודה רבה על התשובות! בהחלט למדנו וקיבלנו כמה מסקנות טובות. גם על גיוון התיק, וגם על שאר הדברים!💥💯👏👏👏

shaishai
Автор

I think a deployments video would be super beneficial. Many engineers and product managers alike take for granted you can "just deploy it" and don't realize there is nuance in doing it the right way.

robertwolinski
Автор

Dear Arjen, really well done once again. I like how you build up the improvement of the docer-compose and reload feature on the second half of the video. This was just the content I needed. At work we are hosting dash apps and use poetry as a package manager but often we have trouble to get something running between the different developer environments. I would love to create a universal developer environment with docker. This lesson is a great starter.

chikken
Автор

This was such a well composed video Arjan! Great work my man!

golammuhaimeen