How to containerize Python applications with Docker

  Рет қаралды 80,002

Docker

Docker

2 жыл бұрын

Did you miss the Docker Community All-Hands on March 31st, 2022?
Here is a replay of the talk hosted by Patrick Loeber (@python_engineer): How to containerize Python applications with Docker.
▶️ Speaker's KZfaq Channel: / pythonengineer
► Description: This talk aimed at beginners shows how to get started with Docker for Python scripts and Python web apps. We look at two different projects and build Docker Containers for a Python script and for a web application using Flask. This also demonstrates how to dockerize a virtual environment.
🐳 Join our community on Slack: dockr.ly/slack
You can follow Docker on social networks:
► Twitter: / docker
► LinkedIn: / docker
► Facebook: / docker.run

Пікірлер: 50
@patloeber
@patloeber 2 жыл бұрын
Had a great time speaking at this Docker event! Thanks for having me!
@oluwolejames1437
@oluwolejames1437 Жыл бұрын
THANKS, FOR THIS GREAT TUTORIAL. I COULD NOT FIND A LINK BELOW AS YOU MENTIONED IN THE VIDEO.
@dilipkumars6556
@dilipkumars6556 Жыл бұрын
No link of github
@fernandocorenstein6531
@fernandocorenstein6531 Жыл бұрын
Super professional as all your content. Thank you!
@jonworkman6147
@jonworkman6147 Жыл бұрын
Finally someone explains it clearly and step-by-step. Thank you
@alute2589
@alute2589 Жыл бұрын
Thank you for your comment, i like your name, as well
@chrischu5769
@chrischu5769 5 ай бұрын
As a beginner in Docker, this tutorial is very clear and concise. It successfully helped me deploy my Python project into Docker. Thank you very much!
@yolosingh-nt4hv
@yolosingh-nt4hv Жыл бұрын
Great thanks to you Patrick.I deployed my first python app successfully.
@raymondcswong8602
@raymondcswong8602 11 күн бұрын
Thank you. Very nice tutorial!
@dariusEMPEROR
@dariusEMPEROR Жыл бұрын
the link IS NOT in the description below
@CyberWorx
@CyberWorx 7 ай бұрын
Thanks a lot for the explanation. It helped me make a POC using python script executing in an environment inside docker.
@faustipez
@faustipez 5 ай бұрын
Very clear explanation, it helps to reduce the fear of using Docker!
@MhonsterPlayer
@MhonsterPlayer Жыл бұрын
I could not build with 'DockerFile', I had to rename it to 'dockerfile'. Also encountered a bug which would not let me run the image. I had to restart docker desktop. Great tutorial ! Learned a lot
@eervin123
@eervin123 2 жыл бұрын
I’m really looking forward to this
@maloof2826
@maloof2826 2 жыл бұрын
Thanks! It has been of great help
@Geza_Molnar_
@Geza_Molnar_ Жыл бұрын
Hi - Thanks for the tutorial! For the 1st example : I wonder if it would be better practice to first install with pip the packages and than copy our code. reason : 'docker build' creates layers in the image file (roughly for each line in the Dockerfile) and caches the content of the layers (to make subsequent builds faster), however when our code changes then the next build can't use the relevant cached layer (because the source --our code-- for that layer changed) AND hence neither can use all the cached layers for lines that are after in the Dockerfile. So, the resulting image is (practically, but not entirely) the same in both ways, but the build processes are faster when we consider what changes more frequently and put that as low in the Dockerfile as it makes sense.
@MaartenMagchiels
@MaartenMagchiels Жыл бұрын
Wonderfull!! Thanks for sharing this 👍👍
@NicholasCifuentes-Goodbody
@NicholasCifuentes-Goodbody Жыл бұрын
Great tutorial!
@shridharpp
@shridharpp Ай бұрын
Thank you :)
@AjirogheneSunny
@AjirogheneSunny Жыл бұрын
no link droped here
@fc1984fc
@fc1984fc Жыл бұрын
Never used docker before. I got a python azure function which works ok in local debug in vs code. My azure yaml pipeline is failing at the build stage due to some dependency issue. Can I clone my local virtual environment, put it into docker, and deploy my app to azure? Will this bypass the build stage problem?
@jimaustin3608
@jimaustin3608 8 ай бұрын
4:07 "First thing to do ..." with any new (to me) piece of code is to make sure it runs. The scrape from Beautiful Soup is returning "403 Forbidden'" so the lists ('years', 'actors_list', etc.) are empty. URL returns expected screen from IMDB so that's correct ... anyone with a fix for the scrape?
@toromanow
@toromanow 4 ай бұрын
Same for me.
@wadkantrips9352
@wadkantrips9352 11 ай бұрын
Thanks a lot!
@hiranyasarma8886
@hiranyasarma8886 Жыл бұрын
Thanks, I tried changing code in any .py file but code changing not reflected
@zackplauche
@zackplauche 10 ай бұрын
Print doesn't work in my app unless I add "-u" to the CMD part of the Dockerfile
@user-kr1ex8cy1z
@user-kr1ex8cy1z 3 ай бұрын
Amazing video, but didn't got the solid reason for using --no-cache-dir in pip install, was it to reduce space or something?
@adammorgan1556
@adammorgan1556 5 ай бұрын
I ran into an error running example 2 on python 3.11. I had to change the version of pydantic in requirements.txt (pydantic==1.10.2).
@ShovonMallick41
@ShovonMallick41 Жыл бұрын
My script is using a dependency json file, where I stored my credentials. what to do if I want to use it while script is running in docker?
@pseudounknow5559
@pseudounknow5559 Жыл бұрын
You just need to add this file with ADD source dest
@fixcorrect
@fixcorrect 10 ай бұрын
docker desktop installed but docker -v command not found mac m2 chip
@serychristianrenaud
@serychristianrenaud 2 жыл бұрын
Thanks ....
@pseudounknow5559
@pseudounknow5559 Жыл бұрын
We really need the github link to follow... Can you please give it ?
@gustavomurta7911
@gustavomurta7911 Жыл бұрын
I can't find it.
@pseudounknow5559
@pseudounknow5559 Жыл бұрын
@@gustavomurta7911 He posted the same video on his channel and we have the Github link in that video ;)
@juanete69
@juanete69 3 ай бұрын
Hello. Why do you need __name__ == '__main__' in this code? I now this will execute only if you call this code from the main program but not if it's imported. But I don't know why we need to make this distinction here.
@sanaullahaq5568
@sanaullahaq5568 2 ай бұрын
unable to find the github link in the description
@aboabdo3985
@aboabdo3985 Жыл бұрын
Hi where is the github link
@pseudounknow5559
@pseudounknow5559 Жыл бұрын
Hi have you find it ? :(
@achajackson5898
@achajackson5898 Жыл бұрын
How do you get command auto-completion ?
@heroe1486
@heroe1486 Жыл бұрын
Shells like zsh or fish give you autocompletion
@Mayur7Garg
@Mayur7Garg 2 жыл бұрын
Isn't using pip --upgrade a bad practice? Ideally you would want to install the exact version of the packages every time to ensure reproducibility and prevent breaking changes to happen due to new versions.
@sureshkrjsl
@sureshkrjsl 2 жыл бұрын
Ya. Always use something like "python3 - m pip install ur-package"
@zack8247
@zack8247 Жыл бұрын
nice pun usage, a-whale-able
@jfertis
@jfertis Жыл бұрын
-i OF THE GODS
@user-wi8pl3lh4k
@user-wi8pl3lh4k Жыл бұрын
unable to run pip install commands from docker file #5 14.57 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/beautifulsoup4/ #5 15.90 Collecting beautifulsoup4
@JustinDS
@JustinDS Жыл бұрын
I am having this same issue
@JustinDS
@JustinDS Жыл бұрын
I updated by WSL and Ubuntu installations and now the pip install runs just fine.
Containerize Python Applications with Docker
20:51
NeuralNine
Рет қаралды 105 М.
Docker VSCode Python Tutorial // Run your App in a Container
19:13
Christian Lempa
Рет қаралды 90 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН
WHY IS A CAR MORE EXPENSIVE THAN A GIRL?
00:37
Levsob
Рет қаралды 21 МЛН
Docker Tutorial For Beginners - How To Containerize Python Applications
22:17
Git MERGE vs REBASE
16:12
Academind
Рет қаралды 1 МЛН
Containerizing Python web apps with Docker, Flask, Nginx & uWSGI
25:38
Why I use docker for my web dev projects
7:55
Web Dev Cody
Рет қаралды 32 М.
The Complete Guide to Python Virtual Environments!
15:52
teclado
Рет қаралды 325 М.
Do NOT Learn Kubernetes Without Knowing These Concepts...
13:01
Travis Media
Рет қаралды 229 М.
Top 8 Docker Best Practices for using Docker in Production
18:27
TechWorld with Nana
Рет қаралды 297 М.
Docker for Web Development | Workshop (DockerCon 2023)
3:37:11
Containerizing a simple Python Flask app using Docker
13:59
Девушка и AirPods Max 😳
0:59
ОТЛИЧНИКИ
Рет қаралды 15 М.
Где раздвижные смартфоны ?
0:49
Не шарю!
Рет қаралды 877 М.
AI от Apple - ОБЪЯСНЯЕМ
24:19
Droider
Рет қаралды 106 М.
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 1,5 МЛН