Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
lxmcf1316410dMy best description is if you put your food on the bench, it will touch the entire bench.
Put your food in a container and on the bench, it will just touch the container.
So running apps in a container in theory can prevent malicious activity for example.
dan-pud47910dAn application inside a container is more portable. It contains the OS and anything else needed to make it run. This allows you to run it on your machine, aws, azure or your dad's and it will run the exact way.
zer025610dHmmm long story short there are two cases that i.m going to explain : using docker in dev env and prod env.
So statting with dev for example having many projects some are running on mysql older or newer php 5 or php 7 some are running in java 7 others in java 8 postgresql etc i simply start a container with the required service and it.s just working don.t need to stay set the env for every project switching. Plus i can play with beta or newest tchnologies withput installing them on local.
On production env the plus side of the doker is the scalability and availabily u can now scale horizontallly not just vertically (u can add more servers not just more ressources to a server) secondly there are technologies that are just fallowing containers and spin a new one or reset a container that is not responding anymore. I have a java backend that has many containers i can update some portions of the app with 0 downtine ...
Hope i gave u some reasons why docker is cool :)
Wack526610dAlthough most have been said:
We had tge problem of: "it works on my machine" you had java 8.x.x, while the server had java 8.y.y installed and so on.
The fix was to use either a dev server or a vm. Now dev server has the downside of non local development, whill vms have the downside of resources. You have hardware run an os, and an hypervisor run an os (per VM). Often this resulted in using one huge VM having apache, php, mysql, ... Installed and never really updated (instead of one vm per service which would be easier in updating these services).
Now enter docker (or other container technologies, there's not just docker!). Instead of having an os, than a hypervisor and one (or multiple) vms runing on top of that you have your "vms" running directly inside your kernel. But completly isolated. You basically get an almost full vm, but without the hypervisor overhead.
2 words: Portability, Lightness
1 line: ability to divide your application into microservices.
And a duck 🐤
deadPix3l66910dSo an example that's been brought up a few times in these comments, but not addressed directly.
Imagine you are shipping an app, and you want to make a simple unit of "this is everything you need, just run it and go" so you ship a VM. Everyone thinks this is a great idea and everyone starts shipping their apps as VMs the world is great but there's one problem:
I'm running 18 Fucking kernels because every freaking vm has it's own kernels and libraries, most of which are the same damn version. Like fuck!
Now imagine if all the VMs were able to recognize that your host machine has a kernel, and all the libraries, and only added what was special to them. What if every VM used the host kernel and libraries and you didn't have a host running a kernel for the sole purpose of running 18 other kernels.
That's a container.
deadPix3l66910d2/2 but wait, why even ship a VM in the first place?
Well because everything you do to a system can cause some weird messup.
This app works 100 percent of the time...well unless you tamper with this file that should never be touched...wait wtf...*2hrs later* oh! So strace reveals that nginx fucks with that file under unknown circumstances...sometimes?.... Huh. But we need nginx... Shit...
It's nice for the app to always be run in a perfectly crafted and consistent environment for everyone always.
Containers are like VMs without all the bloat, speed hits, and all the other problems of VMs.
alkuzad125010dVm is at least 1,5gb, container can take as small as 5mb. It also does not waste CPU/mem
angryotter10510dokay long story short
why use container ?
cause we follow the trends
brunofontes165610dI use it because it is lighter. I can put the entire server system online during code and offline after, with just one command.
If I need other php version to other project, I just open its container. :)
Gophyr22639dEver hear of chroot? A container is basically just a chroot with its own network devices and either nonexistent or horribly configured resource limits.
beegC0de3659dDocker containers can share the host OS kernel. It basically makes deployment easier and it's also easier to parallelize the services you're putting in these containers.
Root323168dSimplest way I can put it:
A VM emulates the hardware as well as the entire guest OS. A container does not.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job