How to containerize Python applications with Docker

preview_player
Показать описание
Did you miss the Docker Community All-Hands on March 31st, 2022?

► 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.

You can follow Docker on social networks:
Рекомендации по теме
Комментарии
Автор

Had a great time speaking at this Docker event! Thanks for having me!

patloeber
Автор

Finally someone explains it clearly and step-by-step. Thank you

jonworkman
Автор

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!

chrischu
Автор

Great thanks to you Patrick.I deployed my first python app successfully.

yolosingh-nthv
Автор

Thanks a lot for the explanation. It helped me make a POC using python script executing in an environment inside docker.

CyberWorx
Автор

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

MhonsterPlayer
Автор

the link IS NOT in the description below

dariusEMPEROR
Автор

unable to find the github link in the description

sanaullahaq
Автор

Very clear explanation, it helps to reduce the fear of using Docker!

faustipez
Автор

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.

Geza_Molnar_
Автор

We really need the github link to follow... Can you please give it ?

pseudounknow
Автор

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?

jimaustin
Автор

Wonderfull!! Thanks for sharing this 👍👍

MaartenMagchiels
Автор

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.

juanete
Автор

Print doesn't work in my app unless I add "-u" to the CMD part of the Dockerfile

zackplauche
Автор

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).

adamcodes
Автор

docker desktop installed but
docker -v command not found mac m2 chip

fixcorrect
Автор

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?

fcfc
Автор

i get this when I docker run
/bin/sh: 1: [“python”, : not found

hoddy
Автор

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?

ShovonMallick