Тёмный

How To Use Docker To Make Local Development A Breeze 

ArjanCodes
Подписаться 236 тыс.
Просмотров 292 тыс.
50% 1

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.
Today I'm going to show you how to do this, using a simple API server in Python as an example. The code for this episode is available on GitHub: github.com/ArjanCodes/2022-do....
🚀 Next-Level Python Skillshare Class: skl.sh/3ZQkUEN
💡 Get my FREE 7-step guide to help you consistently design great software: arjancodes.com/designguide.
💻 ArjanCodes Blog: www.arjancodes.com/blog
🎓 Courses:
The Software Designer Mindset: www.arjancodes.com/mindset
The Software Designer Mindset Team Packages: www.arjancodes.com/sas
The Software Architect Mindset: Pre-register now! www.arjancodes.com/architect
Next Level Python: Become a Python Expert: www.arjancodes.com/next-level...
The 30-Day Design Challenge: www.arjancodes.com/30ddc
🛒 GEAR & RECOMMENDED BOOKS: kit.co/arjancodes.
Check out @codeSTACKr and @JackHerrington's channel I mentioned in the video here:
- / codestackr
- / jackherrington
👍 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!
💬 Discord: discord.arjan.codes
🐦Twitter: / arjancodes
🌍LinkedIn: / arjancodes
🕵Facebook: / arjancodes
👀 Code reviewers:
- Yoriz
- Ryan Laursen
- James Dooley
- Dale Hagglund
🎥 Video edited by Mark Bacskai: / bacskaimark
🔖 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!

Опубликовано:

 

1 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 326   
@ArjanCodes
@ArjanCodes 7 месяцев назад
💡 Get my FREE 7-step guide to help you consistently design great software: arjancodes.com/designguide.
@heliophobicdude
@heliophobicdude Год назад
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!
@MMarcuzzo
@MMarcuzzo Год назад
Never noticed about that. Gonna be aware of this now
@veni_vidi_victorian
@veni_vidi_victorian Год назад
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 ☺️
@pacersgo
@pacersgo Год назад
I see poetry is getting more and more popular. I am wondering what is the advantage of poetry over pip?
@veni_vidi_victorian
@veni_vidi_victorian Год назад
@@pacersgo Poetry is using pip under the hood, and you can still use pip to install packages. There are a lot of benefits to poetry, but the main ones - for me - are: 1) Project initialization Creating a project or initializing one with poetry can be very interactive if you wish it to be. Not leaving the terminal to google for package names or versions has never been easier! More staring at monospace fonts, 11/10. 2) Builtin virtual environment With poetry, you have a built-in shell (initialized with "poetry shell" in your terminal) to run (package-specific) commands in your setup. You can't accidentally install black globally and run it on all your project folders anymore. In my opinion, it's also a lot more convenient than venv or conda. 3) Configuration Poetry configuration is, well, poetry. The details you can fine-tune with in-/exclusions and that you can clearly separate required and optional dependencies are godsent for me. One TL;DR point worth mentioning, poetry shines most in environments where people share the codebase. Whether this is in an open-source scenario or in your closed-source company work, you don't have to worry about everyone needing the same setup on 6 different OSes. Your README will be "1. Install poetry (one curl command). 2. Run poetry install.". If you are using PyCharm, you are immediately notified of missing packages. (Not sure if VSCode has integration for this.) Okay, that's enough fanboying from me. Sorry for the wall of text. Hope you find some time to give it a try :D
@JustinBarak
@JustinBarak Год назад
Poetry is the best
@aflous
@aflous Год назад
Yes please, we need some poetry!
@HaithamSeelawi
@HaithamSeelawi Год назад
If you guys liked poetry you have to give pdm a shot. It is much faster.
@user-hn1cy5ee5l
@user-hn1cy5ee5l Год назад
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)
@ArjanCodes
@ArjanCodes Год назад
Yes, good suggestion!
@christsciple
@christsciple 9 месяцев назад
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!
@ArjanCodes
@ArjanCodes 9 месяцев назад
Thank you!
@sixpooltube
@sixpooltube 8 месяцев назад
Came from Patrick Loebers' video too and found Arjan's to be muuuch more clear.
@jonaszasut17
@jonaszasut17 Год назад
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
@lazyh0rse
@lazyh0rse Год назад
Good points, however, your points are geared toward advanced users, most tutorials on the internet are really bad anyways, so getting started with this thing requires a massive commitment tbh. I appreciate your points, but by looking them on google, they are very hard to follow, because you have to have a good experience in using docker. As someone who just wants to build an image that just works, this alone is just a massive pain in the ass to get it to work for some reason.
@janekschleicher9661
@janekschleicher9661 Год назад
@@lazyh0rse I'd always suggest to add a pre-commit linter for the Dockerfile, e.g. hadolint, that just checks most of the issues, especially the security critical ones (like not pinned versions). To be fair, for such an introductory video, that's probably a bit too much, especially as every linter will suggest to run the docker container as non root, what would add some further settings. But one reason for the poor security overall is that every introduction skips it, so nobody (initially) does it. For example, the --no-cache option, arjan is using here, is something that might be unintuitive (you rarely need it for local work), but very useful and hadolint would pin it (if not included here), too. That's why using linters and following as a result all the best practices you probably you can't know consistently, is really the way to go in practice. (Or just prepare already to get hacked :-o)
@alexanderpoplawski577
@alexanderpoplawski577 Год назад
The docker-compose was not only for volume, but to add a different run command. The idea was to leave the Dockerfile for deployment unchanged and have specific runtime parameters for local testing. I think he mentioned the problems with latest for production. I didn't know about docker-slim, thanks for the suggestion.
@peterszilvasi752
@peterszilvasi752 Год назад
When the comment is more valuable than the video. The slimtoolkit blows my mind. Thank you for the useful informations!
@jonaszasut17
@jonaszasut17 Год назад
@@peterszilvasi752 glad I could be helpful!
@keyone415
@keyone415 Год назад
nice video! but you don't need docker compose for the reload functionality, you can do the volume mapping from the docker run command and also override the uvicorn with the --reload: Here is the command to run: docker run -p 8080:80 -v $(pwd):/app --rm channel-api uvicorn main:app --host 0.0.0.0 --port 80 --reload
@GeorgMayer
@GeorgMayer Год назад
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.
@jajaramillo5
@jajaramillo5 Год назад
On 3:44: the 0.0.0.0 IP address is not localhost; it means to the uvicorn service to accept requests from any IP interface on the server. While localhost is the127.0.0.1 IP address, which couldn't be accessed from outside of the server/virtual machine. Just to clarify!. Great docker guide for beginners.
@leeseoWestport
@leeseoWestport Год назад
Feedback please for the downside of what I’m proposing. How about? 1) Use the python image versions and install ssh server. 2) Create a user, with sudo privileges. Also install other tools you may use: vim, git, zsh, procps, etc. 3) Upon startup of the new image, have your host home folder (or dev) environment to the new user (in container) home folder. Also, re-assign uid and gid of your home to the container user, so we don’t have to worry about permissions and any new files created will also be your host machine’s user. When the container starts up, you run the sshd in foreground. This all can be coordinated in a startup script. Also, expose all ports necessary. I map ssh 22 of container to 2222 of my host machine. 4) Use VSCode’s remote ssh extension to actually use the container environment. If your ssh keys are setup correctly, you can ssh without password to the container as the container user, which is equivalent to you since you re-assigned the uid/gid of the container user to your host user. 5) Your VSCode now can do what you normally do on your host machine such as debugging inside the container. For VSCode, it’s as if you’re running completely inside the container.
@nickheyer
@nickheyer Год назад
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.
@express4863
@express4863 Год назад
Another suggestion for future videos is VSCode + devcontainers + docker. I don't even bother using venvs any more, I just spin up a devcontainer and write my code in that.
@waikinmak5425
@waikinmak5425 10 месяцев назад
Thanks Arjan, this is an awesome video! The problem--solution--problem--solution 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!
@tothestars3958
@tothestars3958 7 месяцев назад
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.
@robertwolinski7294
@robertwolinski7294 Год назад
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.
@ArjanCodes
@ArjanCodes Год назад
On it 😉
@athakur33
@athakur33 Год назад
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.
@btkb1427
@btkb1427 Год назад
Best of luck on your journey:)
@ArjanCodes
@ArjanCodes Год назад
Thanks Anand, glad to hear the videos are helpful to you.
@carecavoador
@carecavoador Год назад
Trust me, you will. Just keep learning and most important: practicing. Arjan gave-me the motivation I needed to restart learning Python, the way he approaches it seems very refreshing to me. Since I started following this channel I already done four micro services to help me and my team with our work automating tasks. I'm saving money to get his course.
@btkb1427
@btkb1427 Год назад
@@carecavoador his course is great :) you will not regret it!
@chikken007
@chikken007 Год назад
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.
@official.mhm13
@official.mhm13 Год назад
The best comprehensive video which explains the whole process really well. Thanks a ton
@MichaelPayPlus
@MichaelPayPlus Год назад
Your content is always so clear to understand and does a great job taking a learner through a journey that is easy to follow!
@ArjanCodes
@ArjanCodes Год назад
Thank you, Michael, glad you’re enjoying the videos!
@sixpooltube
@sixpooltube 8 месяцев назад
You are a f'ing amazing teacher. Most clear video of this topic on RU-vid by far. Subscribed!
@ArjanCodes
@ArjanCodes 8 месяцев назад
Thank you!
@SkipperChuck42
@SkipperChuck42 Год назад
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
@ArjanCodes
@ArjanCodes Год назад
Thanks so much, glad it was helpful!
@benyaminaghaebrahimi5073
@benyaminaghaebrahimi5073 Год назад
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.
@ArjanCodes
@ArjanCodes Год назад
Thanks so much, Benyamin, Glad you liked it!
@golammuhaimeen2825
@golammuhaimeen2825 Год назад
This was such a well composed video Arjan! Great work my man!
@ArjanCodes
@ArjanCodes Год назад
Thank you Golam, glad you liked the video!
@rothscha
@rothscha Год назад
Really helpful step-bystep explanation on using docker for specific python project! Have you also planned to do prepare an ansible + Helm-chart example?
@AndrewAkaHrun
@AndrewAkaHrun Год назад
Nice video! However using docker-compose to map the local folder seems like an overkill to me. You can simply add ‘-v .:/app’ to your docker run command and get exactly the same result. Anyways, looking forward to your deployment video!
@R1c0bones
@R1c0bones Год назад
Both a great, compose you normalize across your team with git. But you also can create a script with -v. But then again... not all developers can execute scripts due security reasons ;) But thank you for the hint with -v.
@teeesen
@teeesen Год назад
This is what I was wondering. What is docker-compose bringing to the table that isn’t already easy with Docker? I guess this video is only scratching the surface.
@shisus1803
@shisus1803 Год назад
Really great video! Only thing I would like to ask is how do you manage the dockerfile used in the docker-compose config when you have different dependencies for prod, testing, local, etc.
@walid7189
@walid7189 4 месяца назад
So here's a great video on docker-compose, you have another on poetry, another on fastapi/pydantic. I would like to see a video demonstrating a good practice of a code base architecture with docker containers as services. For example, an API, that ~maybe~ uses a main package with pre-defined pydantic dataclass abstractions, which other services like the fastapi and idk, a separated Celery service that use mqtt and a database would use the same for handling that pydantic models. just an idea, thanks for your videos
@anishpatelwork
@anishpatelwork Год назад
Been using docker compose for a while. Never realised that you could get hot reloads from it. I love this, going to be implementing it on Monday.
@dma98
@dma98 Год назад
Yet again Arjan saves the day. I was smashing my head for hours trying to figure out how to setup a CMD command in the Dockerfile with lektor instead of uvcorn, where the commas and quotes are etc. Not only it helped me with that, but it showed me that I can actually just write the full command in the compose file, so I don't have to deal with all the specifics
@ArjanCodes
@ArjanCodes Год назад
Glad to hear you found it helpful!
@BruceElgort
@BruceElgort Год назад
Great and informative video. Thank you, Arjan!
@senX
@senX Год назад
great as always, i'd really appreciate more about deployment options. right now im working on a laravel server with a gui and a python api server (flask) without guy and im not sure what the smartest deployment strategy is. i thought about putting the python server up with nginx and uwsgi on a linux vm, but you're probably way more experienced, so i'd love your take on this stuff
@marna_li
@marna_li 5 месяцев назад
Thanks to Docker, I know have a great developer experience. I have a setup of services that I just can start with Compose. Then my services have been configured to use those locally. While in production, they just target the equivalent cloud services.
@RealEstate3D
@RealEstate3D Год назад
Clear, concise, to the point and working. Good job!!
@ArjanCodes
@ArjanCodes Год назад
Thank you!
@dmmeteo
@dmmeteo Год назад
Thank you man! Please make a separate video about different deployments. It is interesting 😉
@kevinlao3690
@kevinlao3690 Год назад
Yes! Definitely would want to see a video on CI/CD and deployments in future. Always looking forward to learning from you
@ArjanCodes
@ArjanCodes Год назад
Thanks. I've put it on the list.
@kevinlao3690
@kevinlao3690 Год назад
@@ArjanCodes looking forward to it :)
@arturkabitcher
@arturkabitcher Год назад
Arjan, brilliant, as always! I tried to approach the topic several times but your video made it so clear to me that I now wonder why I didn't understand it before.
@ArjanCodes
@ArjanCodes Год назад
Thanks so much Artur, glad it was helpful!
@dmc549
@dmc549 Год назад
This guy gets it. Great info, succinct, and to the point. Fast, while still jam packed with content. Subscribed.
@ArjanCodes
@ArjanCodes Год назад
Thanks Dean, glad you liked the video!
@dmc549
@dmc549 Год назад
@@ArjanCodes Keep them coming exactly as you are. Learning so much.
@shaishai416
@shaishai416 Год назад
שידור ממש מעניין! תודה רבה על התשובות! בהחלט למדנו וקיבלנו כמה מסקנות טובות. גם על גיוון התיק,וגם על שאר הדברים!💥💯👏👏👏
@CoentraDZ
@CoentraDZ Год назад
Great video as usual. Could you please continue another video like this deploying the same project in production ?
@preritdas6998
@preritdas6998 Год назад
Awesome. I find the best way to work with containers in this setting is to use a devcontainer. Completely removes the need for this type of docker-compose “magic” as Arjan called it.
@alexjando4880
@alexjando4880 Год назад
Amazing video! It really helped me understand how docker actually works aswell as how to use it.
@malcolmanderson6735
@malcolmanderson6735 Год назад
This is great, I've already got docker desktop installed, and following along was easy. And having your github link to clone, well it's "super easy, barely an inconvenience."
@RafaelGuedes84
@RafaelGuedes84 Год назад
Hi Arjan, I'd love to see a video on the deployment strategies you mentioned. Thanks.
@Hubert4515
@Hubert4515 Год назад
been using docker since 2018 as a dev, it was a game changer for me
@NostraDavid2
@NostraDavid2 Год назад
It was a game-changer for the industry! I don't know if we'll use Docker in 10 years, but it's been a pyvotal (hehe) piece of software that gave us a paradigm shift on how we should build our software. Docker is great!
@Hubert4515
@Hubert4515 Год назад
@@NostraDavid2 well said
@d-shiri
@d-shiri Год назад
Great, more docker videos please. Thanks
@re.liable
@re.liable Год назад
I've got some questions (for Arjan and/or viewers). Just starting to get into containerization • Does this mean I could skip creating a `venv` for my projects, build it as a Docker "app", and run the built image from a container (which contains all the needed dependencies)? I feel like the building step would be a potential bottleneck, but the caching Arjan showed may help with that • On the `docker compose` part of the vid, "volumes" were used, which overrides the copying of files into the `/app` directory. What if I wanted to run the Docker image/container on another machine? Would the files updated since the initial building be available there? Or do I also "package" the volume with the image/container? • How much space would Docker images/containers/volumes generally take up on my machine? I'm running a little low on storage now 😄
@zaharius96
@zaharius96 Год назад
Thank you for such useful videos, you’re great!
@pinch-of-salt
@pinch-of-salt Год назад
Great video! Would be great if you could show other features that docker offers as well like network, more on volumes, etc. How would you debug using the container and not the python running on your machine?
@stelioslagaras5334
@stelioslagaras5334 4 месяца назад
As a greek I fully approve the use of "homogenise" term! Very nice and quality video :)
@ArjanCodes
@ArjanCodes 4 месяца назад
Thank you so much! Glad you enjoyed it.
@richjohnson8261
@richjohnson8261 Год назад
Nice and helpful video right when I needed it. Thanks!
@ArjanCodes
@ArjanCodes Год назад
Glad to hear it!
@adriangonzalez7857
@adriangonzalez7857 Год назад
Awesome video! What terminal do you use or how does it autocomplete commands?
@ipelezikis
@ipelezikis Год назад
Great video again! The video about deployment you mention (6:08) would be a great idea.
@user-pz3wg6ch9b
@user-pz3wg6ch9b 5 месяцев назад
Love and find it useful, also Grateful if you share what plugin or software that you are using to get a suggestion dropdown in the terminal.
@bartoszkrawczyk4976
@bartoszkrawczyk4976 Год назад
I'm primarily working with node, not python, but this really helped me understand how to use docker. Thanks!
@ArjanCodes
@ArjanCodes Год назад
Thank you Bartosz, Glad it was helpful!
@lardosian
@lardosian Год назад
That was a nice simple explanation of Docker, fairly new to it myself so I'm gradually getting up to speed with it as we use it heavily in work on Cloudrun in GCP, thanks.
@ArjanCodes
@ArjanCodes Год назад
Thanks! I used Cloud Run in the past but was put off by the high cold start times and the limited routing options (for example no static IP address possible). Is this still an issue or have they improved things? If so, I might take another look at it.
@lardosian
@lardosian Год назад
@@ArjanCodes I'm not 100% sure as I don't set up things from scratch. But I will say our senior devs think firestore is a bit of a joke as a database due to its query limitations.
@wlgrd7052
@wlgrd7052 Год назад
Nice addition to your repertoire! 👌
@ArjanCodes
@ArjanCodes Год назад
Thanks!
@juanghpx
@juanghpx 9 месяцев назад
Thank you, great explanation and very helpful tips
@ArjanCodes
@ArjanCodes 9 месяцев назад
You're very welcome!
@Horatio_101
@Horatio_101 5 месяцев назад
10:50 Learned something new that I hadn't in other docker videos. Very nice!
@ArjanCodes
@ArjanCodes 5 месяцев назад
Glad the video was helpful, Horatio!
@rajaramanv
@rajaramanv 7 месяцев назад
The lighting for the video is good, but please pay more attention to the audio. You can probably use a collar microphone or equalize the volume in post production. Thanks for the great content.
@swapnilchavan7076
@swapnilchavan7076 Год назад
Amazing video. Your channel is worth spending time. Everything is at it's place. More informative video with simplicity at it's best. Thanks for the video buddy. (In india buddy word is used in forces means the person you trusted most). Thank you.
@raphaelsoares7652
@raphaelsoares7652 Год назад
Arjan, you made me a better python software developer, I love your content! Good job, keep it going! 🚀
@ArjanCodes
@ArjanCodes Год назад
Thanks Raphael, glad to hear the content is helpful. And will do 😉.
@user-mn8nn7rg3t
@user-mn8nn7rg3t 5 месяцев назад
Thank you very much. It was very helpful.
@ArjanCodes
@ArjanCodes 5 месяцев назад
I'm glad it was helpful!
@_kopiter_
@_kopiter_ Год назад
I wish, all of the dev stack would be covered by you :) so much useful info
@kintukintu2098
@kintukintu2098 Год назад
Finally!! Thank you so much for considering the request
@ArjanCodes
@ArjanCodes Год назад
No problem 😊
@jorgev4656
@jorgev4656 Год назад
Yes please talk about different types of deployment. Thxs
@jenpen3249
@jenpen3249 Год назад
Yes Arjan! Please make a video about deployment for applications/executable using Python, this pipeline is so undercovered!
@Akahatoo
@Akahatoo Год назад
Cool video, quite simple in delivering the message and with great content!
@ArjanCodes
@ArjanCodes Год назад
Thanks Felipe, happy you’re enjoying the content!
@paertske
@paertske Год назад
Thank you Arjan for your clear and concise videos! Your video editing is top-notch and you provide real-world examples that are even understandable for people from the Commodore 64 era. Your content is just the right depth, and I appreciate all that you do!
@ArjanCodes
@ArjanCodes Год назад
Thank you so much!
@jw3983
@jw3983 4 месяца назад
Thanks for this great video again! This really helps to get along with this new docker trend. Could you further explain the difference between a python virtual environment and a docker container? can i use both or is it even necessary to use a virtual environment within a docker container?
@esmaelmohamed8209
@esmaelmohamed8209 5 месяцев назад
Arjan Please I need more docker, deployment also k8 i love the way you teach❤❤❤❤
@TorHagemann
@TorHagemann Год назад
The main benefits of compose appear when you have more than one subsystem, e.g. a DB or cache (like redis) that is also involved in your project. (i.e. very often) Then, your containers can depend upon the DB and refer to 1) volumes, 2) networks, and 3) one another by name, along with some well-known ports, which are possible to expose and map (as desired) via the host node, no matter which port(s) the process in the container thinks it has bound. I would suggest: a second, follow-up video 🙂 that could go a little deeper into the basics of using Docker in development/otherwise--e.g. a Dockerfile should ideally include a USER directive so that the service doesn't "run as root" even inside the container, and expose 8080 to map to another port on the host. User management in a container might seem kinda "belt-and-suspenders" before you read about Docker CVEs, but it's really a good practice for peace of mind if nothing else! My personal style is also to keep docker-compose for dev only, and my Dockerfile (with build args where relevant, plus targets like `make dev` vs. `make image` in a Makefile) for dev/prod envs.
@ThePenitentOneArg
@ThePenitentOneArg 8 месяцев назад
Docker it's incredible for deployment but for development I always find easier ways to deal with it. If it's a Python app, poetry and pipenv provide pretty decent isolation so no dev environment is needed If it's a node app (like React), you can use nvm and specify version in a .nvmrc file What I find really useful is to define external services that are also dependencies of the project in a docker compose file. You can set RabbitMQ, Postgres, Redis and whatever you need there and use docker compose up to start everything
@edip_c
@edip_c Год назад
Your videos are like (Python) poems or songs to me! Great job as always!!!👏🏻👏🏻👏🏻
@ArjanCodes
@ArjanCodes Год назад
Thanks so much Edip, glad the content is helpful!
@jithinsasikumar9576
@jithinsasikumar9576 Год назад
Hey Arjan, Your videos are the best. It's well explained and precise. Keep up the good work. Just one request - If possible, please make a video series on MLOps !!!!!
@ArjanCodes
@ArjanCodes Год назад
Great suggestion, thank you!
@jeovaramos3709
@jeovaramos3709 Год назад
Great video! Thank you a lot. Perhaps, you could do a video talking about CI/CD. I think it is the next level from here.
@silkogelman
@silkogelman Год назад
Really nice Docker introduction, thank you Arjan! 🙏😀 I love that you included how to handle automatic reload for changes in the data during development and the caching thingy Also I really like your code readability, for example that when you load the data you name it channels_raw, and that you name them channel when they become dataclass Channel Objects. More tutorials about Docker and deploying them would be very much appreciated! Also hoping for best practices on how to update code or container versions after deployment, especially when there is live database data involved. (In my case I've setup Docker containers for Django, PostgreSQL, Celery + Beat, Redis and pgadmin.)
@silkogelman
@silkogelman Год назад
And if I can make a little suggestion: you may want to include something about PYTHONUNBUFFERED and PYTHONDONTWRITEBYTECODE for setting up the Dockerfile in your tutorials. Oh and about .env files, environmental variables for the deployment videos. Like for the database passwords and API keys etc.
@ArjanCodes
@ArjanCodes Год назад
Thanks Sil, happy you’re enjoying the content!
@davidl3383
@davidl3383 Год назад
Thank your Arjan for this excellent video. Jut to be sure, i learn Python currently, if we use docker we don't need to use environments like pipenv or poetry exact? When we want to work on a project, we just activte a container and that’s al ?
@iamghezali
@iamghezali 8 месяцев назад
Thank you for the video, it helps a lot
@ArjanCodes
@ArjanCodes 8 месяцев назад
Glad it helped
@bberakable
@bberakable Год назад
Fantastic video - much appreciated!🥰
@ArjanCodes
@ArjanCodes Год назад
Glad you enjoyed it!
@DavidFodor1
@DavidFodor1 Год назад
Thank you Arjan for the video, amazing quality and content as always. I have a question regarding using docker in a local development environment. If I keep adding packages to my requirements.txt file docker-compose up is not installing them but rebuilding takes ages. Do you know what is the proper way to take care about this when in development? Is there a docker version of pip install?
@aljabadi9941
@aljabadi9941 Год назад
Thanks for the amazing video :) I am curious what theme you are using in VSCode? It is elegant!
@edgeeffect
@edgeeffect Год назад
Over in the PHP world, our bosses have a terrible obsession with running totally obsolete versions of PHP. For this, Docker is a godsend!
@BritleFoot
@BritleFoot Год назад
marvelous, thank you!
@ArjanCodes
@ArjanCodes Год назад
Thanks so much, glad you liked it!
@lucienchardon6819
@lucienchardon6819 Год назад
Great video, thank you! The only issue is that when i now switch from my local python venv development environment to the local docker env, VS code asks me for every project to install the development dependencies like black etc. Could you explain how you integrate your VS code python extensions with your docker workflow? Thanks!
@ajeetis
@ajeetis Год назад
Simple, yet powerful
@qkz3es
@qkz3es Год назад
easy to understand intro, nice video
@Han-ve8uh
@Han-ve8uh Год назад
18:18 "you can change the code and when you save the file it will automatically RESTART THE CONTAINER because of the volume syncing option" 1. Is the code update really because of volume syncing option? Isn't it because of the --reload flag in uvicorn? Whether we use VOLUME or --reload are 2 independent decisions with 4 possible permutations right? 2. Does docker really restart the container for any change in files specified in volume? That doesn't make sense intuitively. If some process is writing to a local folder continuously (eg. 1 new file per second) and docker container takes more than 1 second to restart, the whole system breaks down. 19:23 also shows that only the process restarted with a StateReload detected changes WARNING log, but the container did not restart.
@scarsellifi
@scarsellifi Год назад
Great Video! regarding the chapter "Dealing with change in the data" is there a similar solution for gunicorn and flask?
@stokestack
@stokestack Год назад
Very helpful, thanks. At 09:17 you talk about building your image upon the python:latest image; where does that come from? Is this the name of an image that's made available by someone somewhere? Where is it retrieved from?
@lofmaan
@lofmaan Год назад
Very nice tutorial, salute to you :)
@ArjanCodes
@ArjanCodes Год назад
Thank you, glad you like content.
@rohitpatil3534
@rohitpatil3534 Год назад
Needed this for so long lol
@stello1972
@stello1972 Год назад
Very nice. Very clear. Your pronunciation was spot on btw.
@ArjanCodes
@ArjanCodes Год назад
Glad you think so!
@vicidilochi
@vicidilochi 10 месяцев назад
Huge thanks
@TehProxy
@TehProxy Год назад
at 12:56 what terminal are you using that gives you hovered suggestions for the command you're typing out?
@ArjanCodes
@ArjanCodes Год назад
I'm using Fig, it's free and it's really cool: github.com/withfig/fig
@fedegarro58
@fedegarro58 Год назад
Excellent video! One question though: In your case you are working in with your local computer, but what's the "best practices" workflow for developing and testing an image (locally I guess) that is going to be deployed into a K8s cluster, and that has different hardware than my laptop? To explain the context a bit, I'm running some deep learning code that needs gpus and my laptop doesn't have any so I launch a "training job" into the K8s cluster (K8s is probably not meant to be used this way, but is the way that we use it where I work) and I'm not sure how I should be developing and testing my Docker images. At the moment I'm creating a container that has the desired gpu and manually running a bunch of commands till I can make the code work. Then, once I got the code running, I manually copy all the commands from history that made the code work and then copy them to a local docker file on my computer, compile it and push it to a docker hub, from which the docker image is going to be pulled the next time I launch a training job into the cluster, that will create a container from it and train the model. The problem with this approach is that if there's a bug in the image, I have to wait until the deployment to the container to realize that my Docker file is wrong and I have to start the process all over again to change it. Also finding bugs from the output of kubectl logs is very cumbersome. Is it a better way to do this? I was thinking of installing docker into the docker container and use IntelliJ (or any other IDE) to connect to the container via SSH and develop and test the image remotely; but I read in many places that this is not a good idea. What would you recommend then instead? Many thanks!!
@holographictheory1501
@holographictheory1501 Год назад
I would love a video on FastAPI from you! Thank you for another great video, I was just thinking the other day how much I wanted your perspective on Docker
@ArjanCodes
@ArjanCodes Год назад
Great suggestion, thank you! glad you liked the video!
@Serbekh
@Serbekh Год назад
Great video! Please show your VS Code config!
@lker-dev
@lker-dev 2 месяца назад
Is there a good trick to make the container python interpreter available so my IDE has better visibility of what is installed in the container or do i need to replicate the installs locally as well?
@dmenisdevdevelopment7158
@dmenisdevdevelopment7158 Год назад
Nice, simple clear instructions. Would be nice to have seen how to debug (with breakpoints) in the container.
@ArjanCodes
@ArjanCodes Год назад
Thanks for the suggestion. I've put it on the list.
@a.7388
@a.7388 Год назад
Will the changes with docker-compose propagate the other way around? For instance, if we make a change to a data file in docker, would the local file be changed too?
@Andremzsptm
@Andremzsptm Год назад
Great video as always Arjan. You're approaching 100k subs too fast, congrats!
@ArjanCodes
@ArjanCodes Год назад
Thank you Andre, and yes, it’s going so fast!
@drooten
@drooten Год назад
This might sound cliché, but don’t let those numbers change the simplicity of your presentations, or the depth of solutions. Appreciate all the effort you got to with these videos!
@ArjanCodes
@ArjanCodes Год назад
Thank you @Available Messenger! Though of course I'm very honored that so many people find my videos helpful, in the end the subscriber count is mostly a vanity metric. I'm mainly looking at metrics like viewing time and whether my existing audience is actually returning to watch more videos to determine what I should work on.
Далее
Docker Crash Course for Absolute Beginners [NEW]
1:07:39
ГЕНИИ МАРКЕТИНГА 😂
00:35
Просмотров 1,6 млн
Прилетели в Дубай
00:17
Просмотров 75 тыс.
How to create a great dev environment with Docker
29:55
Using docker in unusual ways
12:58
Просмотров 387 тыс.
Never install locally
5:45
Просмотров 1,6 млн
Python Logging: How to Write Logs Like a Pro!
11:02
Просмотров 150 тыс.
100+ Docker Concepts you Need to Know
8:28
Просмотров 774 тыс.
The Ultimate Guide to Writing Functions
24:31
Просмотров 176 тыс.
How to Use FastAPI: A Detailed Python Tutorial
20:38
Просмотров 207 тыс.
This Is Why Python Data Classes Are Awesome
22:19
Просмотров 788 тыс.
ГЕНИИ МАРКЕТИНГА 😂
00:35
Просмотров 1,6 млн