Docker容器使用宿主机内核还是基础镜像内核?修改宿主机内核后的容器疑问
Great question—let’s break this down in plain terms, since this is a common point of confusion between containers and virtual machines.
Core Rule: Containers Share the Host System’s Kernel
Docker containers aren’t full virtual machines. Unlike VMs, which spin up their own separate kernel alongside the host, containers run directly on the host’s kernel. The base image you use only provides the user-space environment (like system libraries, binaries, shell tools, and distribution-specific configurations)—it does not include a kernel at all.
Your Specific Scenario Answered
If you’ve modified the kernel of your local Ubuntu 16.04 host, any container you launch—even one based on an Ubuntu 14.04 image—will use your modified Ubuntu 16.04 kernel.
Here’s why: The Ubuntu 14.04 base image just mimics the user-space of Ubuntu 14.04 (e.g., older versions of apt, gcc, or system libraries). The kernel that actually powers the container is always the one running on your host machine, never anything from the image.
You can easily confirm this inside the container by running:
uname -r
This command will spit out the kernel version of your Ubuntu 16.04 host, not the kernel version typically associated with Ubuntu 14.04.
内容的提问来源于stack exchange,提问作者doruk.sonmez




