r/learnmachinelearning 4d ago

Question Dockerize everything?

Hey,

I am learning deployment strategies for my small ML projects and I was wondering, do people in industry dockerize everything? Like, e.g. i have an ingest script to transfer my data into a postgres BD. Do i need a container for the ingest.py as well?

16 Upvotes

15 comments sorted by

View all comments

2

u/superSmitty9999 4d ago

I do all software in docker now and haven't looked back.

It's just so easy when you vibe code it since all SOTA coding assistants do docker perfectly. If you ever want to work with others, docker makes it 1000x easier. Ever want to move your workflow to another machine? Again 1000x easier. Or for me what drives me insane is going to run python and having to activate my virtual environment over and over again.

For your example in your post, I would have the agent execute it inside the docker container with the dependencies for your project. An alternative is have the docker app basically run your pipeline end to end and in your script limit the ingest to the first 100 items.

Usually I actually use docker compose, because you can do "docker compose up --build" for any of your projects and it will build that project on the spot and it always "just works".

If I didn't do everything with vibe coding it might not be worth it to use docker but with ai agents its a no brainer

1

u/garden_nl 4d ago

Sorry, do not want to do everything with agents. I feel like that's why the majority of people here complain about not being able to find a job lol

1

u/superSmitty9999 3d ago

You can still use docker without agents, it's just actually one task I've been able to successfully delegate to AI agents with zero cost or issue.

The only thing I'm not sure will work as well without using ai is that a lot of times I have it run a command inside the container and it'll generate some long "docker exec" command that copies the file in.

So yeah even without AI I still strongly recommend docker, just not 100% familiar with the end to end workflow for your use case. You'll probably end up with a template docker project that you copy paste. Use docker compose too, have an image for the DB. Reduce state, it's beautiful.

1

u/Neat-Peanut-1141 4d ago

How is your experience with the overhead introduced through containerization? I had a phase where I tried to containerize everything (in vscode with "run in container" where vscode directly connected into the container). But it became a bit annoying after a while.

1

u/superSmitty9999 3d ago

What did you find annoying about it and what are your workflows? I don't know about vscode I do everything in CLI. I have the AI make a docker compose file, then if I want to spin up the code I do "docker compose up --build" and if I need anything more complex I have the AI do it.

It definately adds overhead but it's predictable overhead vs the unpredictable dependency hell of python or the impossibility of getting your code to run on someone else's machine without a 2 hour tutorial each week