Is docker a solution for making application cross

2019-02-08 06:54发布

I'm getting started with docker by reading some blogs and introduction material.

My understanding is docker can wrap a single application into a standardized container. The container provides a sandbox, all the necessary resources the application needs to run, and the application inside always live within that container. That means I can ship the container to everywhere( different kind of OS or even cloud platforms ) and it should still can be run correctly.

If my understanding is correct, then does that mean maybe microsoft can wrap their office suits into a container and I can install and run it on mac os or linux? And some other nice Mac application can also be shipped to windows and linux?

1条回答
欢心
2楼-- · 2019-02-08 07:31

Docker is a user-friendly layer on top of LXC, a set of Linux kernel features allowing namespacing of filesystem configuration, network resources, process tables, and other kernel-mediated resources which were historically global. (It's much closer to FreeBSD jails than it is to kvm or VMware).

These features are very specific to Linux, and an application running in a Docker container is still interfacing directly with the host's Linux kernel (though it only has access to the subset of resources exposed to the namespaces in which it participates). Similarly, opcodes are run directly on the hardware with no emulation on virtualization in place, so hardware differences are not abstracted away either

Docker is thus not a cross-OS (or cross-architecture) portability layer, and it will not successfully hide implementation details from applications which depend on specific kernel versions, much less entirely different operating systems altogether.


Early 2017 Update

Docker now runs on Mac, by bundling a lightweight virtualization stack very similar to kvm on Linux. When running this way, it's actually doing both virtualization and containerization -- the former to run a (single) Linux kernel, the latter to run a series of separate containers within this kernel.

This still means that it's limited to running native Linux apps, and it still doesn't provide a display layer for desktop applications (X11, VNC, or something else along those lines needs to be used in addition). However, by bundling a virtualization tool, modern Docker now is something of a portability solution (across platforms, not architectures).

查看更多
登录 后发表回答