4 ms·
Docker is building, running, and sharing VMs from the command line.
by ythn 9y ago
Docker is building, running, and sharing VMs from the command line.
- wonderous 9y agoContainers are not VMs (virtual machines): https://blog.docker.com/2016/03/containers-are-not-vms/ https://blog.docker.com/2016/03/containers-are-not-vms/
- PascLeRasc 9y agoThank you for illustrating my point.
- fossuser 9y agoI don't understand why people don't frame the explanation in the context of what problem the thing is trying to solve. Imagine you have to install a database (let's say postgres) on your machine. You could just install it the regular way - when you do this postgres uses certain things by default like the port 5432. Now you're going to install a different piece of software on the machine, but this software also uses port 5432 by default and there's an error about the port already being in use. This is a pain, now you have to change the default port. It turns out these conflicts are happening for a lot of things on the machine and it's a hassle to have to make non-standard changes all over the place that you have to keep track of. For your first attempt to solve this you decide to run postgres in a virtual machine and connect to that, but now you have an entire extra operating system to deal with and all of the overhead that comes with that. Plus you have to configure access to the VM and get all of those pieces to work too. It'd be nice if there was a way to just install postgres in a place that is easily accessible, but separate from the rest of your machine with regard to things like ports and such. A "container" that it could be installed in that automatically handles things like port conflicts in some magical backend you don't have to deal with so it looks to you like you can always just use the defaults. This container model is basically docker (or at least my current understanding of it).
- PascLeRasc 9y agoHuh? What's a port? How do I "install a database"? I already have Excel on my laptop anyway. You lost me at around the third sentence.
- caseymarquis 9y agoYou may not be the target audience. Docker is a tool primarily used to help efficiently deploy your networked applications on new servers. If you don't need to deploy server apps, you can stop reading here. If you do need to deploy apps to servers, docker is worth investigating. It replaces a complex install script and git clones with an efficient clone of a lightweight 'vm' which is ready to run your app immediately.
- cpburns2009 9y agoI hope this PostgreSQL example is simply meant to illustrate a point, and not taken from personal experience. I say that because PostgreSQL is designed to run multiple instances on different ports, and you can run multiple versions along side each other as well. All it takes is editing a couple configuration files.
- legostormtroopr 9y agoFor me this falls down because my next questions is "cool, so I can run a database in a docker. So my data is save inside the docker?" Which it isn't, and I still don't know how to attach permanent storage to a docker (if thats even the right term).
- TheCoelacanth 9y agoWhat you want is called a "volume". When running a docker container you just pass in the -v option and it maps a directory outside the container to a path that can be used from inside the docker container, e.g. `docker run -v /host/directory:/container/directory ...` would make the directory /host/directory on the host machine accessible inside the container at the path /container/directory. https://docs.docker.com/engine/admin/volumes/volumes/ https://docs.docker.com/engine/admin/volumes/volumes/
- TallGuyShort 9y agoI'm laughing my head off at how your comment, precisely about this point, has spawned a conversation that has included, "it's like a VM", "it's not like a VM", "it depends on how you define VM", "there are lots of definitions for VM", "you can use a volume, just use the --volume flag", "that's not for volumes, that for bind mounts". OH MY GOSH CAN YOU PEOPLE NOT SEE HOW BADLY DEFINED ALL OF THE NOMENCLATURE IS?
- TuringTest 9y agoBut they serve the same purpose, even if their implementations are entirely different. So it makes sense to provide an initial explanation of one in terms of the other, in special for people who already have some mental model of what virtual machines do.
- pathseeker 9y agoNo, they don't serve the same purpose. Try running a Microsoft Exchange in a Docker container on a Linux server. Then try running it in a Windows VM on a Linux server.
- deleted 9y ago[deleted]
- automoton1 9y agoEven if they don't always serve the same purpose, they serve a similar purpose in a number of examples. It's still a valid analogy to get someone thinking about how they might work.
- abritinthebay 9y agoContainers are not VMs in the same way that WINE is Not An Emulator. That is... yes, that's technically true but to the end user there is very very little difference, if any, unless you start playing with advanced stuff that affects the guts.
- ythn 9y agoPedantry like this is what scared OP away to begin with. Sometimes you have to resist the urge to correct or convey technical details for someone who will not understand the technical details anyway. For example, when explaining bitcoin to people I use the analogy of a stack of receipts. That's not technically how a blockchain works, but my mom doesn't care how a blockchain works.
- ghaff 9y agoI tend to agree in general but I'm not sure in this case. The fact that containers are/were a form of operating system virtualization--which is how they were once referred to--is probably one of the least interesting aspects of how they're used today. If I were explaining them to someone less technical I'd say something like they're a way to package programs with the other stuff programs need to run so that they can be reliably and quickly started up and moved from place to place.
- Dylan16807 9y agoYeah they are. There are many types of VM.
- deleted 9y ago[deleted]
- dogweather 9y agoYou’re describing Vagrant