Linux Container vs JVM Linux Container vs JVM docker docker

Linux Container vs JVM


A java program running on top of the JVM will be a single Linux process. The JVM runs inside the process, and interprets (or compiles) the Java byte code in your classes.

A docker container is more heavyweight. There's the docker daemon, the docker container, which is actually a virtualized Linux instance, and then your JVM running under that.

I found https://docs.docker.com/engine/getstarted/step_one/ and https://docs.docker.com/engine/userguide/eng-image/baseimages/ helpful.


They are significantly different. A java program is a process on the OS kernel. A JVM is running, which executes the bytecode that is the java program. The java program could use any amount of resources (depending upon the JVM limits), and use the operating system in any way it likes.

A docker container is an implementation of Operating System Virtualization. The easiest way to understand containers would be that it provides an independent slice of the operating system using virtualization. The container's resource usage can be limited and can be isolated so that it is unaware of any part of the system outside the container, Like the Filesystem, the network, the processes. The kernel provides specific features - CGroups and Namespaces which are used to provide containers.