Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


a question to docker
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

a question to docker

say we are running: docker run apache
will this launch a virtual OS at the first, then have apache server installed and run in the virOS?
so every docker command run a virtual OS in fact? I am just not sure.
Thanks

Comments

  • Partly correct.

    We need to understand that an OS contains two parts: kernel and userland. Your docker container does NOT include a kernel. Instead it uses your host’s kernel, so we cannot say a docker container runs an OS.

    But in most cases your docker image does provider userland files including binaries, libraries and conf files. And it just behave like an OpenVZ server.

    Thanked by 2frakass devp
  • edited September 2022

    Docker was bread from LXC initially, but developed to running single tasks per container rather than the whole stack (encouraging multiple containers to construct a more complex stack).

    You can run a full Linux distro in a docker container, by running init or some other system orchestrator as the task and including everything else in the template for it to call, much like is done with LXC, OVZ, and their ilk, but that isn't what it is designed for. If you do this then you have a full OS in the same sense as you would with LXC/OVZ/other (the entire userland, sharing the hosts kernel).

    Docker containers often contain more than just that one process they are run for (and supporting libraries), such as a shell and tools for doing admin via “docker exec” or maybe even a SSH daemon for remote admin more directly, but these extras will (well, should) be minimal.

    So in your Apache example: it probably doesn't run init or anything like so can't be called a full OS, it will likely just launch Apache directly.


    Summary:

    KVM, VMWare, etc.: Full virtual machines, runs full OS with its own kernel.

    LXC, LXD, OVZ, etc.: Containers, sharing host kernel, usually runs full OS userland though can be minimal instead.

    Docker: Containers, sharing host kernel, usually runs a single task though can run a fuller userland if you want.

    The difference is essentially intent: do you want the container to behave like a VM or are you just trying to conveniently separate & manage processes (& their dependencies) and their access to resources? Docker's tooling is geared around the latter.

    Thanked by 3frakass Void 0xbkt
  • You can pack whole docker container in a package and store that in repository.
    These stored package image can be launched directly having a quick boot of complete service in seconds and can be used to build other derivative images.

    Example includes debian docker image used for building apache on debian docker image.

Sign In or Register to comment.