2

Been watching lots of videos about Docker lately, yet I still can't wrap my head around it. Especially that I'm just new to web development.

Comments
  • 5
    Docker explained in 2 words:
    chroot & cgroups
  • 2
  • 3
    @reiniellematt not a linux/unix person, eh? :)
  • 4
    It's like convinience food packaging for cloud software.

    Here is a good page to learn docker.
    www.katacoda.com
  • 4
    @reiniellematt chroot changes the filesystem root for a process, cgroups are process control groups that isolate the processes and restrict their resource usage.

    Docker uses both of those to create "containers" that sort of behave like virtual machines running a single application (except there is no virtualization going on which makes them perform as well as normal applications)
  • 3
    docker does os level virtualization, as opposed to platform virtualization, eg vmware, virtualbox.

    docker is mostly used through its cli (unlike the others I mentioned that are mostly run with guis).

    is it extremely easy and quick to start a container. these containers can be used to replicate a system with little code and time.

    let's say your eebsite has some specific stack (web server, framework, db, whatever else)

    even though most software nowadays is cross platform, instructions for installing and configuring and connecting all the pieces together is a platform specific task and can take days.

    with docker, you can reliably replicate a system that your site can run on.

    you have to migrate your site to a new machine with a different os? if your site is dockerized you install docker and just run one docker command to deploy and run.

    also, virtualization has the benefit of increased security, since the software running it has restricted access to the host (the os running it).
  • 1
    Imagine a mini computer, on which you can install an OS (no virtualisation though) and let it perform tasks. For example you link a volume of docker to a folder on your pc and you can let it run npm install, build, copy files to www folder and start a node server. Its sandboxed so you dont have to have node or other dependencies, just docker. We share our frontend end webserver with our testers and po without having to upload to an online server. I can run a Laravel website with mysql, php, phpmyadmin etc on a windows machine without jnstalling anything. Its awesome
  • 2
    @reiniellematt
    these two are there to limit processes.

    chroot says:
    "you will treat this /home/me/jail directory as your root dir. It will now be your '/'. You can create your own dirs in there, your own files, you're adviced to have your own /bin in there, but you will under no circumstances be allowed to go outside this your new root dir. This is your jail"

    cgroups says:
    "you can use up to 2G of ram tops, you are capped to 1 cpu core, you are limited to 6 megs of disk space, etc, etc."

    this way there is no need for virtualisation at all. You're running a bunch of processes in containers, which are nothing but separate cgroups, jail [and some other] configuration sets. [this is not the case for docker on windows! It requires hyperv]

    There is no other os. If you have, say, ubuntu, you spin up a container w/ centos, the container image will only have applications you usually find in centos. But the kernel remains the same -- ubuntu.
  • 3
    @reiniellematt in fact, it is not even anything new. Look up lxc [linux containers]. Docker is built on top of them. Lxc has been around since 2008. Openvz is even older - 2005. And unix OSes had this concept even before. For instance solaris containers ('04)
  • 0
    @netikras nope, Windows because I'm still a student and I would like to use C#
  • 0
    So to put it simply, this is mostly done on web applications especially those that contains lots of parts like a database. Instead of setting them up and having different settings, I just put them in one package and put that package everywhere and it will work just the same?
Add Comment