r/AskProgramming • • Jun 12 '20

Why is docker a thing?

I'm genuinely curious here, not trying to ask a loaded question, is just that... I don't really understand why is so widespread, so I'll just go with my particular case:

I'm on $Big_Corp. We have many stuff obviously standardized, and for our web applications we have been told to use a dockerized database. I started a small project from scratch and to connect to a $Standard_Database I just downloaded $Standard_Database, installed it on my machine, configured it and began working with it.

Of course, this is on a development environment, so more or less, who cares how I got this set up, but I'm approaching a point in which I got to "get real" with the database, which implies setting up a docker image of $Standard_Database.

Now, for what I've seen and I'm reading, this is just some kind of container that will (in theory) only have that database, with docker itself running in memory for I don't really understand what. From the point of my application and my database-access program, I will only have to change the database connection info and I would be good to go.

I kind of understand a potential need for having independent systems and all that, but, as someone who really love continuous integration and has spent lot of time making processes that deploy cleanly, I don't really see the point on making a new layer just to have this database for this application.

Maybe I'm having here a too narrow view and in a bigger org is needed to keep things tidy (thus my case of use would be just "the way corporate has told us to do things", maybe I'm missing something here. And thus, I'm asking here about it.

53 Upvotes

30 comments sorted by

View all comments

104

u/truh Jun 12 '20

Have you ever heard of the phrase works on my machine? Docker does a fairly good job of solving those issues.

7

u/[deleted] Jun 12 '20

Thats actually not even that correct. Stuff that works on docker with linux containers under windows is not guaranteed to work on docker under linux if you get into some advanced stuff. Under the hood you are using the kernel resources, and kernels can differ in implementation.

If "works on your machine but doesn't work in prod" is an issue, the solution is to set up the dev environment to mirror prod, not to dockerize. Or alternatively go hardware virtualization with full VMs so you can control for things like kernels.

5

u/truh Jun 12 '20

Stuff that works on docker with linux containers under windows is not guaranteed to work on docker under linux if you get into some advanced stuff.

That's why I qualified it as doing just a fairly good job. I'm using docker for obscurish hardware, CUDA and realtimeish networking on different host OSs and are somewhat familiar with its limitations.

2

u/julianeone Jun 12 '20 edited Jun 13 '20

I know Docker is pretty serious about getting things to work in Windows; I interviewed there, and that was really clear. Under Nadella at Microsoft, I would think that's even more true. They are incentivized to play nicely with Windows. To the extent that they don't, they're not giving Windows users or companies a reason to use Docker, and believe me, Docker cares deeply about the Windows market, almost more than any former startup I've seen in the Bay Area.

2

u/[deleted] Jun 12 '20

Yeah but in most cases you're comparing a development environment to a production environment, not your local development machine.

Anyone who goes from laptop directly to prod is being irresponsible anyway.