使用Docker时共享主机操作系统的内核 [英] Sharing kernel of the host operating system while using Docker

查看:65
本文介绍了使用Docker时共享主机操作系统的内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 如果我在我的Ubuntu计算机(充当主机OS-已安装Docker)上部署通过选择Alpine Linux作为基础映像构建的映像,那么这里是否会有两个内核在起作用-一个来自Ubuntu还有另一个来自阿尔卑斯山?我读到Docker容器将共享主机内核,因此我有点困惑.

  1. If I deploy an image built by choosing Alpine Linux as the base image on my Ubuntu machine (which acts as the host OS - where Docker is installed), will there be two kernels at play here - one from Ubuntu and another one from Alpine? I read that Docker containers will share the host Kernel, so I'm bit confused here.

如果我登录到正在运行的容器并发出另一个命令,那么从主机操作系统的角度来看,这将是另一个过程吗?还是这将是另一个线程?从来宾操作系统的角度来看,我认为这将是两个单独的过程.

If I login to a running container and issue another command, will this be another process from the perspective of the host OS? Or will this be another thread? From the perspective of the guest OS, I think it will be two separate processes.

请澄清.

推荐答案

  1. 容器"只是一个抽象术语.这只是在主机(Ubuntu)上运行的另一个进程.由于您的来宾(Alpine)和主机(Ubuntu)都是基于Linux内核的操作系统.最后,您在来宾操作系统中运行的任何命令或程序都将(通过低级库)转换为系统调用,并提供给Ubuntu主机的内核.

  1. A "container" is just an abstract term. It is just another process running on the Host (Ubuntu). Since your guest (Alpine) and Host (Ubuntu) both are Linux kernel based operating systems. Any command or program you run in the guest OS will be translated (by low level libraries) to system calls in the end and given to the kernel of the Ubuntu host.

容器"不过是主机内核对其应用一些通用策略的一组进程.因此,假设您在来宾操作系统中运行的任何命令或程序(如您所说的那样) ping 都会在主机上创建一个进程,该进程具有与您的容器所应用的内核相同的策略.

A "container" is nothing but a group of processes to which the host kernel applies some common policies. So any command or program you run in the guest OS (as you call it) let's say ping will create a process on host with the same policies applied by the kernel as you container.

这篇关于使用Docker时共享主机操作系统的内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆