Docker容器识别
编辑想研究的课题是容器的渗透,一大方向就是容器逃逸。那么逃逸前自然需要判断是否处在容器中。那么就需要了解容器有哪些特征。假设进入一台远程服务器,通过何种手段开源判断此环境是否在容器之中。
容器虚拟技术有很多,最主流的就是Docker,也比较方便搭建实验环境。所以就先研究Docker的容器特征。手边刚好有Docker环境、WSL环境(Kali)、阿里云ECS(CentOS)和Hyper-V虚拟机(Kali)四种环境可以拿来做对比实验,VMWare我电脑上暂时没安装,就忽略了。
1 查看文件
1.1 查看/proc/1/cgroup
文件
可以查看/proc/1/cgroup
文件,也可以看/proc/self/cgroup
。
cat /proc/1/cgroup
cat /proc/self/cgroup
两个指令作用相似,都是查看cgroup信息,如果出现docker
字样,就说明当前环境可能在Docker容器中。
1.1.1 各环境下实验
Docker环境
# cat /proc/1/cgroup
15:name=systemd:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
14:misc:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
13:rdma:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
12:pids:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
11:hugetlb:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
10:net_prio:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
9:perf_event:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
8:net_cls:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
7:freezer:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
6:devices:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
5:memory:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
4:blkio:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
3:cpuacct:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
2:cpu:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
1:cpuset:/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
0::/docker/5104ed1f33bf9e9d36fe99b75b03fedfc2b7e795b741fcfa9985de31dd3a6e0a
可以看到docker
字样,还能看到容器ID。
WSL环境
$ cat /proc/1/cgroup
15:name=systemd:/
14:misc:/
13:rdma:/
12:pids:/
11:hugetlb:/
10:net_prio:/
9:perf_event:/
8:net_cls:/
7:freezer:/
6:devices:/
5:memory:/
4:blkio:/
3:cpuacct:/
2:cpu:/
1:cpuset:/
0::/
ECS环境
# cat /proc/1/cgroup
11:devices:/
10:memory:/
9:pids:/
8:freezer:/
7:perf_event:/
6:blkio:/
5:net_prio,net_cls:/
4:cpuset:/
3:hugetlb:/
2:cpuacct,cpu:/
1:name=systemd:/
Hyper-V环境
$ cat /proc/1/cgroup
0::/init.scope
1.1.2 知识点
1.1.2.1 Linux的proc目录
/proc
目录是Linux系统中的一个虚拟文件系统,有时也被称为proc文件系统。它并不占用实际的磁盘空间,而是由内核在内存中动态生成和维护的。
/proc/[pid]/cgroup
文件提供了进程所属的各个控制组(cgroups)的详细信息。该文件的内容显示了每个控制组的子系统名称、控制组层次结构的路径以及该进程在该控制组中的相关属性。
/proc/1/cgroup
文件的内容可能是这样的:
11:cpuset:/
10:perf_event:/
9:memory:/
8:blkio:/
7:devices:/
6:pids:/
5:net_cls,net_prio:/
4:freezer:/
3:cpuacct,cpu:/
2:hugetlb:/
1:name=systemd:/init.scope
0::/init.scope
每一行都代表一个控制组,通常格式如下:
ID
: 子系统的唯一ID(有些可能是逗号分隔的,表示多个子系统共享相同的层次结构)。Subsystems
: 该控制组涉及的子系统名称(例如cpuset、memory、cpu等)。Cgroup Path
: 控制组在子系统层次结构中的路径。
1.1.2.2 cgroup信息
控制组(cgroups)是Linux内核提供的一种机制,用于限制、记录和隔离进程组使用的资源(如CPU、内存、磁盘I/O等)。它为系统管理员提供了一个统一的框架来管理系统资源,并允许对进程进行细粒度的控制。cgroups是Linux容器(如Docker)等虚拟化技术的基础组件之一。
1.2 查看/proc/1/status文件
cat /proc/1/status
1.2.1 各环境下实验
Docker环境
# cat /proc/1/status
Name: sh
Umask: 0022
State: S (sleeping)
Tgid: 1
Ngid: 0
Pid: 1
PPid: 0
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 64
Groups: 0
NStgid: 1
NSpid: 1
NSpgid: 1
NSsid: 1
VmPeak: 4632 kB
VmSize: 4632 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 800 kB
VmRSS: 800 kB
RssAnon: 68 kB
RssFile: 732 kB
RssShmem: 0 kB
VmData: 184 kB
VmStk: 132 kB
VmExe: 112 kB
VmLib: 2112 kB
VmPTE: 52 kB
VmSwap: 0 kB
HugetlbPages: 0 kB
CoreDumping: 0
THP_enabled: 1
Threads: 1
SigQ: 0/61583
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000000
SigCgt: 0000000000010002
CapInh: 0000000000000000
CapPrm: 00000000a80425fb
CapEff: 00000000a80425fb
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000
NoNewPrivs: 0
Seccomp: 2
Seccomp_filters: 1
Speculation_Store_Bypass: thread force mitigated
SpeculationIndirectBranch: conditional force disabled
Cpus_allowed: ffff
Cpus_allowed_list: 0-15
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 18
nonvoluntary_ctxt_switches: 1
WSL环境
$ cat /proc/1/status
Name: init(kali-linux
Umask: 0022
State: S (sleeping)
Tgid: 1
Ngid: 0
Pid: 1
PPid: 0
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 128
Groups:
NStgid: 1
NSpid: 1
NSpgid: 0
NSsid: 0
VmPeak: 2460 kB
VmSize: 2460 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 1604 kB
VmRSS: 1604 kB
RssAnon: 108 kB
RssFile: 0 kB
RssShmem: 1496 kB
VmData: 316 kB
VmStk: 132 kB
VmExe: 1348 kB
VmLib: 8 kB
VmPTE: 44 kB
VmSwap: 0 kB
HugetlbPages: 0 kB
CoreDumping: 0
THP_enabled: 1
Threads: 2
SigQ: 0/61583
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: fffffffc7ff9fefe
SigCgt: 0000000000000000
CapInh: 0000000000000000
CapPrm: 000001ffffffffff
CapEff: 000001ffffffffff
CapBnd: 000001ffffffffff
CapAmb: 0000000000000000
NoNewPrivs: 0
Seccomp: 0
Seccomp_filters: 0
Speculation_Store_Bypass: thread vulnerable
SpeculationIndirectBranch: conditional enabled
Cpus_allowed: ffff
Cpus_allowed_list: 0-15
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 42
nonvoluntary_ctxt_switches: 0
ECS环境
# cat /proc/1/status
Name: systemd
Umask: 0000
State: S (sleeping)
Tgid: 1
Ngid: 0
Pid: 1
PPid: 0
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 128
Groups:
VmPeak: 191048 kB
VmSize: 125648 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 4100 kB
VmRSS: 3692 kB
RssAnon: 1544 kB
RssFile: 2148 kB
RssShmem: 0 kB
VmData: 83228 kB
VmStk: 132 kB
VmExe: 1424 kB
VmLib: 3732 kB
VmPTE: 112 kB
VmSwap: 0 kB
Threads: 1
SigQ: 0/15073
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 7be3c0fe28014a03
SigIgn: 0000000000001000
SigCgt: 00000001800004ec
CapInh: 0000000000000000
CapPrm: 0000001fffffffff
CapEff: 0000001fffffffff
CapBnd: 0000001fffffffff
CapAmb: 0000000000000000
NoNewPrivs: 0
Seccomp: 0
Speculation_Store_Bypass: vulnerable
Cpus_allowed: 3
Cpus_allowed_list: 0-1
Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 184468
nonvoluntary_ctxt_switches: 5635
Hyper-V环境
$ cat /proc/1/status
Name: systemd
Umask: 0000
State: S (sleeping)
Tgid: 1
Ngid: 0
Pid: 1
PPid: 0
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 256
Groups:
NStgid: 1
NSpid: 1
NSpgid: 1
NSsid: 1
Kthread: 0
VmPeak: 24036 kB
VmSize: 22188 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 12920 kB
VmRSS: 12920 kB
RssAnon: 3328 kB
RssFile: 9592 kB
RssShmem: 0 kB
VmData: 2688 kB
VmStk: 132 kB
VmExe: 40 kB
VmLib: 11992 kB
VmPTE: 80 kB
VmSwap: 0 kB
HugetlbPages: 0 kB
CoreDumping: 0
THP_enabled: 1
untag_mask: 0xffffffffffffffff
Threads: 1
SigQ: 1/7318
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 7fefc1fe28014a03
SigIgn: 0000000000001000
SigCgt: 00000000000004ec
CapInh: 0000000000000000
CapPrm: 000001ffffffffff
CapEff: 000001ffffffffff
CapBnd: 000001ffffffffff
CapAmb: 0000000000000000
NoNewPrivs: 0
Seccomp: 0
Seccomp_filters: 0
Speculation_Store_Bypass: thread vulnerable
SpeculationIndirectBranch: conditional enabled
Cpus_allowed: 3
Cpus_allowed_list: 0-1
Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 1532
nonvoluntary_ctxt_switches: 368
1.3 查看.dockerenv文件
Docker容器在根目录下可能存在一个名为.dockerenv
的文件,该文件的作用我没有找到一个明确的说明。网上有文章说它是配置文件,但我在实际容器中查看该文件是空的,什么信息都没有记录。然后又问了下文心一言.dockerenv
文件记录了什么信息,回复说:
在Docker容器中,
.dockerenv
文件是一个标志文件,它本身并不记录任何具体的配置或环境信息。该文件的存在是为了让进程可以判断其是否在Docker容器中运行。通常,该文件是空的,其唯一的作用是作为一个指示器。当Docker启动一个容器时,它会在容器的根目录下创建
.dockerenv
文件。应用程序或脚本可以通过检查该文件的存在来判断它们是否在Docker环境中运行。例如,一些应用程序可能会根据这个标志来改变它们的行为或配置。然而,
.dockerenv
文件并不是一个标准的Unix隐藏文件(尽管它以点开头),它不会被ls -a
命令列出,除非你使用docker exec
进入容器内部并查看。实际上,你通常不会直接与.dockerenv
文件交互;它更多是Docker内部使用的一个机制。需要注意的是,有些资料可能会提到
.dockerenv
包含环境变量或配置信息,但这是不准确的。环境变量和配置信息是通过其他方式(如Dockerfile指令、docker run
命令参数或Docker Compose文件)设置和传递的,并不是存储在.dockerenv
文件中。如果你需要在容器内部检查是否运行在Docker环境中,可以通过检查
/proc/1/cgroup
文件或使用其他系统调用来实现,而不是直接查找.dockerenv
文件,因为该文件的存在和行为可能会随着Docker版本的更新而发生变化。
感觉说的还挺有道理,至少和目前看到的情况是一致的。
不管如何,查看根目录是否有.dockerenv
文件这个方法是可行的。注意,定制化程度较高的Docker容器可能也没有这个文件。
ls -al /
ll /
类似的还有.dockerinit
文件,只不过该文件在较新的Docker版本下已经不存在了。
1.3.1 各环境下实验
Docker环境
# ls -al /
total 72
drwxr-xr-x 1 root root 4096 Mar 4 02:07 .
drwxr-xr-x 1 root root 4096 Mar 4 02:07 ..
-rwxr-xr-x 1 root root 0 Mar 4 02:07 .dockerenv
drwxr-xr-x 2 root root 4096 Apr 3 2020 bin
drwxr-xr-x 2 root root 4096 Apr 24 2018 boot
drwxr-xr-x 5 root root 340 Mar 4 02:07 dev
drwxr-xr-x 1 root root 4096 Mar 4 02:07 etc
drwxr-xr-x 1 root root 4096 May 28 2020 home
drwxr-xr-x 1 root root 4096 May 28 2020 lib
drwxr-xr-x 2 root root 4096 Apr 3 2020 lib64
drwxr-xr-x 2 root root 4096 Apr 3 2020 media
drwxr-xr-x 2 root root 4096 Apr 3 2020 mnt
drwxr-xr-x 2 root root 4096 Apr 3 2020 opt
dr-xr-xr-x 349 root root 0 Mar 4 02:07 proc
drwx------ 1 root root 4096 May 28 2020 root
drwxr-xr-x 1 root root 4096 Apr 24 2020 run
drwxr-xr-x 1 root root 4096 Apr 24 2020 sbin
drwxr-xr-x 2 root root 4096 Apr 3 2020 srv
dr-xr-xr-x 11 root root 0 Mar 4 02:05 sys
drwxrwxrwt 1 root root 4096 May 28 2020 tmp
drwxr-xr-x 1 root root 4096 Apr 3 2020 usr
drwxr-xr-x 1 root root 4096 Apr 3 2020 var
确实存在一个.dockerenv
文件,文件大小为零,没有任何记录信息。
WSL环境
$ ll /
total 2124
lrwxrwxrwx 1 root root 7 May 31 2023 bin -> usr/bin
drwxr-xr-x 2 root root 4096 May 16 2023 boot
drwxr-xr-x 11 root root 3060 Mar 4 09:36 dev
drwxr-xr-x 3 root root 4096 Jan 26 21:16 Docker
drwxr-xr-x 109 root root 4096 Mar 4 09:36 etc
drwxr-xr-x 3 root root 4096 Aug 10 2023 home
-rwxrwxrwx 1 root root 2105848 Dec 20 06:30 init
lrwxrwxrwx 1 root root 7 May 31 2023 lib -> usr/lib
lrwxrwxrwx 1 root root 9 May 31 2023 lib64 -> usr/lib64
drwx------ 2 root root 16384 Aug 10 2023 lost+found
drwxr-xr-x 2 root root 4096 May 31 2023 media
drwxr-xr-x 8 root root 4096 Sep 6 10:31 mnt
drwxr-xr-x 2 root root 4096 May 31 2023 opt
dr-xr-xr-x 232 root root 0 Mar 4 09:36 proc
drwx------ 6 root root 4096 Jan 27 15:10 root
drwxr-xr-x 7 root root 140 Mar 4 09:36 run
lrwxrwxrwx 1 root root 8 May 31 2023 sbin -> usr/sbin
drwxr-xr-x 2 root root 4096 May 31 2023 srv
dr-xr-xr-x 11 root root 0 Mar 4 09:36 sys
drwxrwxrwt 8 root root 4096 Jan 27 20:55 tmp
drwxr-xr-x 14 root root 4096 Oct 19 16:06 usr
drwxr-xr-x 11 root root 4096 May 31 2023 var
那个Docker文件夹应该是因为我电脑上装了Docker,和自身环境没有关系。
ECS环境
# ll /
total 76
lrwxrwxrwx. 1 root root 7 Jan 25 10:21 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 Jan 25 10:37 boot
drwxr-xr-x 19 root root 3020 Feb 28 19:16 dev
drwxr-xr-x. 91 root root 12288 Mar 4 09:48 etc
drwxr-xr-x. 5 root root 4096 Feb 26 16:48 home
lrwxrwxrwx. 1 root root 7 Jan 25 10:21 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Jan 25 10:21 lib64 -> usr/lib64
drwx------. 2 root root 16384 Jan 25 10:21 lost+found
drwxr-xr-x. 2 root root 4096 Apr 11 2018 media
drwxr-xr-x. 2 root root 4096 Apr 11 2018 mnt
drwxr-xr-x. 3 root root 4096 Feb 25 16:34 opt
drwxr-xr-x 2 root root 4096 Feb 25 16:27 patch
dr-xr-xr-x 130 root root 0 Feb 25 16:09 proc
dr-xr-x---. 8 root root 4096 Mar 4 00:03 root
drwxr-xr-x 28 root root 880 Mar 4 10:06 run
lrwxrwxrwx. 1 root root 8 Jan 25 10:21 sbin -> usr/sbin
drwxr-xr-x. 2 root root 4096 Apr 11 2018 srv
dr-xr-xr-x 13 root root 0 Feb 25 16:09 sys
drwxrwxrwt. 9 root root 4096 Mar 4 10:05 tmp
drwxr-xr-x. 13 root root 4096 Jan 25 10:21 usr
drwxr-xr-x. 19 root root 4096 Feb 25 16:21 var
drwxr-xr-x 9 root root 4096 Mar 3 09:18 www
Hyper-V环境
$ ll /
total 1048648
lrwxrwxrwx 1 root root 7 Feb 25 10:35 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Feb 25 11:20 boot
drwxr-xr-x 17 root root 3300 Mar 5 21:00 dev
drwxr-xr-x 182 root root 12288 Mar 5 21:00 etc
drwxr-xr-x 3 root root 4096 Feb 25 10:57 home
lrwxrwxrwx 1 root root 27 Feb 25 11:19 initrd.img -> boot/initrd.img-6.6.9-amd64
lrwxrwxrwx 1 root root 27 Feb 25 11:19 initrd.img.old -> boot/initrd.img-6.6.9-amd64
lrwxrwxrwx 1 root root 7 Feb 25 10:35 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Feb 25 10:48 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 Feb 25 10:35 lib64 -> usr/lib64
drwx------ 2 root root 16384 Feb 25 11:15 lost+found
drwxr-xr-x 2 root root 4096 Feb 25 10:35 media
drwxr-xr-x 2 root root 4096 Feb 25 10:35 mnt
drwxr-xr-x 3 root root 4096 Feb 25 10:47 opt
dr-xr-xr-x 216 root root 0 Mar 6 2024 proc
drwx------ 4 root root 4096 Feb 25 10:41 root
drwxr-xr-x 35 root root 860 Mar 5 21:01 run
lrwxrwxrwx 1 root root 8 Feb 25 10:35 sbin -> usr/sbin
drwxr-xr-x 3 root root 4096 Feb 25 10:51 srv
-rw------- 1 root root 1073741824 Feb 25 11:19 swapfile
dr-xr-xr-x 13 root root 0 Mar 6 2024 sys
drwxrwxrwt 13 root root 4096 Mar 5 21:09 tmp
drwxr-xr-x 16 root root 4096 Feb 25 10:48 usr
drwxr-xr-x 12 root root 4096 Mar 5 21:00 var
lrwxrwxrwx 1 root root 24 Feb 25 11:19 vmlinuz -> boot/vmlinuz-6.6.9-amd64
lrwxrwxrwx 1 root root 24 Feb 25 11:19 vmlinuz.old -> boot/vmlinuz-6.6.9-amd64
2 查看系统信息
1. 查看mount信息
mount | grep '/ type'
各环境下实验
Docker环境
# mount | grep '/ type'
overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/PKM2ZYM2FGALMKIZM3XQIWADT3:/var/lib/docker/overlay2/l/JRWLAQ6K4WCJBASWE3IJWQSF6U:/var/lib/docker/overlay2/l/PTCRLTZQBPXUAZZO47P3QAJH6R:/var/lib/docker/overlay2/l/4IPE7F6D23WYKIXGYICLEGVKTL:/var/lib/docker/overlay2/l/JMVKECYPFKE4TUBUX4S5UOIMDW:/var/lib/docker/overlay2/l/J6OHTCNVCHHJYRKCTRPOB7K3MR:/var/lib/docker/overlay2/l/BTEIZV7IN3JMLAGLDOMY337NRG:/var/lib/docker/overlay2/l/DFEBEBBC7HMIVIZKOBQY3RFA5K:/var/lib/docker/overlay2/l/NWKTKGNDLQU4MNKQ3TDAB5WQRD:/var/lib/docker/overlay2/l/YM2WDJOZUZX5YUVP3UZSNN7PFO:/var/lib/docker/overlay2/l/ORMS3MLCVMUAV7TWPXYNTLRPEL:/var/lib/docker/overlay2/l/5LTECZFOVRFRQZYD6KB3MBSNOL:/var/lib/docker/overlay2/l/32RTYS77YK4UV7ZIBZPITVGIGB:/var/lib/docker/overlay2/l/DFEU54MTRKTDQQ5YPFTIQORZW2:/var/lib/docker/overlay2/l/6TGRXWPSSVQTX5VO6TO55JWV6Z:/var/lib/docker/overlay2/l/V3XSVR3U2CTBZR5HSZUFVT4VFC:/var/lib/docker/overlay2/l/QTMR2SDCQVEVLOG56SGL6KZO74:/var/lib/docker/overlay2/l/FTONRGLI2YY4RS4JPLPJDEITQP:/var/lib/docker/overlay2/l/L2K7KRXTVM6DK5AG3XONY6HSVV,upperdir=/var/lib/docker/overlay2/b7bc189f454286fb83d6e96cacaa21d7a528cddeb92b697ff3a5f0fbd8303719/diff,workdir=/var/lib/docker/overlay2/b7bc189f454286fb83d6e96cacaa21d7a528cddeb92b697ff3a5f0fbd8303719/work)
WSL环境
$ mount | grep '/ type'
/dev/sde on / type ext4 (rw,relatime,discard,errors=remount-ro,data=ordered)
ECS环境
# mount | grep '/ type'
/dev/vda1 on / type ext4 (rw,relatime,data=ordered)
Hyper-V环境
$ mount | grep '/ type'
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
2. 查看块设备
容器内默认无块设备
ls -l /dev
各环境下实验
Docker环境
# ls -l /dev
total 0
lrwxrwxrwx 1 root root 11 Mar 4 07:25 core -> /proc/kcore
lrwxrwxrwx 1 root root 13 Mar 4 07:25 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Mar 4 07:25 full
drwxrwxrwt 2 root root 40 Mar 4 07:25 mqueue
crw-rw-rw- 1 root root 1, 3 Mar 4 07:25 null
lrwxrwxrwx 1 root root 8 Mar 4 07:25 ptmx -> pts/ptmx
drwxr-xr-x 2 root root 0 Mar 4 07:25 pts
crw-rw-rw- 1 root root 1, 8 Mar 4 07:25 random
drwxrwxrwt 2 root root 40 Mar 4 07:25 shm
lrwxrwxrwx 1 root root 15 Mar 4 07:25 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Mar 4 07:25 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Mar 4 07:25 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Mar 4 07:25 tty
crw-rw-rw- 1 root root 1, 9 Mar 4 07:25 urandom
crw-rw-rw- 1 root root 1, 5 Mar 4 07:25 zero
WSL环境
$ ls -l /dev
total 0
crw-rw-rw- 1 root root 10, 235 Mar 4 09:36 autofs
drwxr-xr-x 2 root root 40 Mar 4 09:36 block
drwxr-xr-x 2 root root 140 Mar 4 10:06 bsg
crw-rw-rw- 1 root root 10, 234 Mar 4 09:36 btrfs-control
drwxr-xr-x 3 root root 60 Mar 4 09:36 bus
crw-rw-rw- 1 root root 5, 1 Mar 5 07:38 console
crw-rw-rw- 1 root root 10, 125 Mar 4 09:36 cpu_dma_latency
crw-rw-rw- 1 root root 10, 203 Mar 4 09:36 cuse
drwxr-xr-x 2 root root 80 Mar 4 09:36 dri
crw-rw-rw- 1 root root 10, 127 Mar 4 09:36 dxg
lrwxrwxrwx 1 root root 13 Mar 4 09:36 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Mar 4 09:36 full
crw-rw-rw- 1 root root 10, 229 Mar 4 09:36 fuse
crw-rw-rw- 1 root root 229, 0 Mar 4 10:06 hvc0
crw-rw-rw- 1 root tty 229, 1 Mar 4 09:36 hvc1
crw-rw-rw- 1 root root 229, 2 Mar 4 09:36 hvc2
crw-rw-rw- 1 root root 229, 3 Mar 4 09:36 hvc3
crw-rw-rw- 1 root root 229, 4 Mar 4 09:36 hvc4
crw-rw-rw- 1 root root 229, 5 Mar 4 09:36 hvc5
crw-rw-rw- 1 root root 229, 6 Mar 4 09:36 hvc6
crw-rw-rw- 1 root root 229, 7 Mar 4 09:36 hvc7
crw-rw-rw- 1 root root 1, 11 Mar 4 09:36 kmsg
crw-rw-rw- 1 root root 10, 232 Mar 4 09:36 kvm
brw-rw-rw- 1 root root 7, 0 Mar 4 09:36 loop0
brw-rw-rw- 1 root root 7, 1 Mar 4 09:36 loop1
brw-rw-rw- 1 root root 7, 2 Mar 4 09:36 loop2
brw-rw-rw- 1 root root 7, 3 Mar 4 09:36 loop3
brw-rw-rw- 1 root root 7, 4 Mar 4 09:36 loop4
brw-rw-rw- 1 root root 7, 5 Mar 4 09:36 loop5
brw-rw-rw- 1 root root 7, 6 Mar 4 09:36 loop6
brw-rw-rw- 1 root root 7, 7 Mar 4 09:36 loop7
crw-rw-rw- 1 root root 10, 237 Mar 4 09:36 loop-control
drwxr-xr-x 2 root root 60 Mar 4 09:36 mapper
crw-rw-rw- 1 root root 1, 1 Mar 4 09:36 mem
drwxr-xr-x 2 root root 60 Mar 4 09:36 net
crw-rw-rw- 1 root root 1, 3 Mar 4 09:36 null
crw-rw-rw- 1 root root 10, 144 Mar 4 09:36 nvram
crw-rw-rw- 1 root root 108, 0 Mar 4 09:36 ppp
crw-rw-rw- 1 root root 5, 2 Mar 5 15:46 ptmx
crw-rw-rw- 1 root root 249, 0 Mar 4 09:36 ptp0
drwxr-xr-x 2 root root 0 Mar 4 09:36 pts
brw-rw-rw- 1 root root 1, 0 Mar 4 09:36 ram0
brw-rw-rw- 1 root root 1, 1 Mar 4 09:36 ram1
brw-rw-rw- 1 root root 1, 10 Mar 4 09:36 ram10
brw-rw-rw- 1 root root 1, 11 Mar 4 09:36 ram11
brw-rw-rw- 1 root root 1, 12 Mar 4 09:36 ram12
brw-rw-rw- 1 root root 1, 13 Mar 4 09:36 ram13
brw-rw-rw- 1 root root 1, 14 Mar 4 09:36 ram14
brw-rw-rw- 1 root root 1, 15 Mar 4 09:36 ram15
brw-rw-rw- 1 root root 1, 2 Mar 4 09:36 ram2
brw-rw-rw- 1 root root 1, 3 Mar 4 09:36 ram3
brw-rw-rw- 1 root root 1, 4 Mar 4 09:36 ram4
brw-rw-rw- 1 root root 1, 5 Mar 4 09:36 ram5
brw-rw-rw- 1 root root 1, 6 Mar 4 09:36 ram6
brw-rw-rw- 1 root root 1, 7 Mar 4 09:36 ram7
brw-rw-rw- 1 root root 1, 8 Mar 4 09:36 ram8
brw-rw-rw- 1 root root 1, 9 Mar 4 09:36 ram9
crw-rw-rw- 1 root root 1, 8 Mar 4 09:36 random
crw-rw-rw- 1 root root 251, 0 Mar 4 09:36 rtc0
brw-rw-rw- 1 root root 8, 0 Mar 4 09:36 sda
brw-rw-rw- 1 root root 8, 16 Mar 4 09:36 sdb
brw-rw-rw- 1 root root 8, 32 Mar 4 09:36 sdc
brw-rw-rw- 1 root root 8, 48 Mar 4 10:06 sdd
brw-rw-rw- 1 root root 8, 64 Mar 4 10:06 sde
crw-rw-rw- 1 root root 21, 0 Mar 4 09:36 sg0
crw-rw-rw- 1 root root 21, 1 Mar 4 09:36 sg1
crw-rw-rw- 1 root root 21, 2 Mar 4 09:36 sg2
crw-rw-rw- 1 root root 21, 3 Mar 4 10:06 sg3
crw-rw-rw- 1 root root 21, 4 Mar 4 10:06 sg4
drwxrwxrwt 2 root root 40 Mar 4 09:36 shm
lrwxrwxrwx 1 root root 15 Mar 4 09:36 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Mar 4 09:36 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Mar 4 09:36 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Mar 5 14:38 tty
crw-rw-rw- 1 root root 4, 0 Mar 4 09:36 tty0
crw-rw-rw- 1 root root 4, 1 Mar 4 09:36 tty1
crw-rw-rw- 1 root root 4, 10 Mar 4 09:36 tty10
crw-rw-rw- 1 root root 4, 11 Mar 4 09:36 tty11
crw-rw-rw- 1 root root 4, 12 Mar 4 09:36 tty12
crw-rw-rw- 1 root root 4, 13 Mar 4 09:36 tty13
crw-rw-rw- 1 root root 4, 14 Mar 4 09:36 tty14
crw-rw-rw- 1 root root 4, 15 Mar 4 09:36 tty15
crw-rw-rw- 1 root root 4, 16 Mar 4 09:36 tty16
crw-rw-rw- 1 root root 4, 17 Mar 4 09:36 tty17
crw-rw-rw- 1 root root 4, 18 Mar 4 09:36 tty18
crw-rw-rw- 1 root root 4, 19 Mar 4 09:36 tty19
crw-rw-rw- 1 root root 4, 2 Mar 4 09:36 tty2
crw-rw-rw- 1 root root 4, 20 Mar 4 09:36 tty20
crw-rw-rw- 1 root root 4, 21 Mar 4 09:36 tty21
crw-rw-rw- 1 root root 4, 22 Mar 4 09:36 tty22
crw-rw-rw- 1 root root 4, 23 Mar 4 09:36 tty23
crw-rw-rw- 1 root root 4, 24 Mar 4 09:36 tty24
crw-rw-rw- 1 root root 4, 25 Mar 4 09:36 tty25
crw-rw-rw- 1 root root 4, 26 Mar 4 09:36 tty26
crw-rw-rw- 1 root root 4, 27 Mar 4 09:36 tty27
crw-rw-rw- 1 root root 4, 28 Mar 4 09:36 tty28
crw-rw-rw- 1 root root 4, 29 Mar 4 09:36 tty29
crw-rw-rw- 1 root root 4, 3 Mar 4 09:36 tty3
crw-rw-rw- 1 root root 4, 30 Mar 4 09:36 tty30
crw-rw-rw- 1 root root 4, 31 Mar 4 09:36 tty31
crw-rw-rw- 1 root root 4, 32 Mar 4 09:36 tty32
crw-rw-rw- 1 root root 4, 33 Mar 4 09:36 tty33
crw-rw-rw- 1 root root 4, 34 Mar 4 09:36 tty34
crw-rw-rw- 1 root root 4, 35 Mar 4 09:36 tty35
crw-rw-rw- 1 root root 4, 36 Mar 4 09:36 tty36
crw-rw-rw- 1 root root 4, 37 Mar 4 09:36 tty37
crw-rw-rw- 1 root root 4, 38 Mar 4 09:36 tty38
crw-rw-rw- 1 root root 4, 39 Mar 4 09:36 tty39
crw-rw-rw- 1 root root 4, 4 Mar 4 09:36 tty4
crw-rw-rw- 1 root root 4, 40 Mar 4 09:36 tty40
crw-rw-rw- 1 root root 4, 41 Mar 4 09:36 tty41
crw-rw-rw- 1 root root 4, 42 Mar 4 09:36 tty42
crw-rw-rw- 1 root root 4, 43 Mar 4 09:36 tty43
crw-rw-rw- 1 root root 4, 44 Mar 4 09:36 tty44
crw-rw-rw- 1 root root 4, 45 Mar 4 09:36 tty45
crw-rw-rw- 1 root root 4, 46 Mar 4 09:36 tty46
crw-rw-rw- 1 root root 4, 47 Mar 4 09:36 tty47
crw-rw-rw- 1 root root 4, 48 Mar 4 09:36 tty48
crw-rw-rw- 1 root root 4, 49 Mar 4 09:36 tty49
crw-rw-rw- 1 root root 4, 5 Mar 4 09:36 tty5
crw-rw-rw- 1 root root 4, 50 Mar 4 09:36 tty50
crw-rw-rw- 1 root root 4, 51 Mar 4 09:36 tty51
crw-rw-rw- 1 root root 4, 52 Mar 4 09:36 tty52
crw-rw-rw- 1 root root 4, 53 Mar 4 09:36 tty53
crw-rw-rw- 1 root root 4, 54 Mar 4 09:36 tty54
crw-rw-rw- 1 root root 4, 55 Mar 4 09:36 tty55
crw-rw-rw- 1 root root 4, 56 Mar 4 09:36 tty56
crw-rw-rw- 1 root root 4, 57 Mar 4 09:36 tty57
crw-rw-rw- 1 root root 4, 58 Mar 4 09:36 tty58
crw-rw-rw- 1 root root 4, 59 Mar 4 09:36 tty59
crw-rw-rw- 1 root root 4, 6 Mar 4 09:36 tty6
crw-rw-rw- 1 root root 4, 60 Mar 4 09:36 tty60
crw-rw-rw- 1 root root 4, 61 Mar 4 09:36 tty61
crw-rw-rw- 1 root root 4, 62 Mar 4 09:36 tty62
crw-rw-rw- 1 root root 4, 63 Mar 4 09:36 tty63
crw-rw-rw- 1 root root 4, 7 Mar 4 09:36 tty7
crw-rw-rw- 1 root root 4, 8 Mar 4 09:36 tty8
crw-rw-rw- 1 root root 4, 9 Mar 4 09:36 tty9
crw-rw-rw- 1 root root 4, 64 Mar 4 09:36 ttyS0
crw-rw-rw- 1 root root 4, 65 Mar 4 09:36 ttyS1
crw-rw-rw- 1 root root 4, 66 Mar 4 09:36 ttyS2
crw-rw-rw- 1 root root 4, 67 Mar 4 09:36 ttyS3
crw-rw-rw- 1 root root 1, 9 Mar 4 09:36 urandom
crw-rw-rw- 1 root root 7, 0 Mar 4 09:36 vcs
crw-rw-rw- 1 root root 7, 1 Mar 4 09:36 vcs1
crw-rw-rw- 1 root root 7, 128 Mar 4 09:36 vcsa
crw-rw-rw- 1 root root 7, 129 Mar 4 09:36 vcsa1
crw-rw-rw- 1 root root 7, 64 Mar 4 09:36 vcsu
crw-rw-rw- 1 root root 7, 65 Mar 4 09:36 vcsu1
drwxr-xr-x 2 root root 60 Mar 4 09:36 vfio
crw-rw-rw- 1 root root 10, 238 Mar 4 09:36 vhost-net
crw-rw-rw- 1 root root 247, 0 Mar 4 09:36 vport0p0
crw-rw-rw- 1 root root 247, 1 Mar 4 09:36 vport0p1
crw-rw-rw- 1 root root 10, 126 Mar 4 09:36 vsock
crw-rw-rw- 1 root root 1, 5 Mar 4 09:36 zero
ECS环境
# ls -l /dev
total 0
crw------- 1 root root 10, 58 Feb 28 19:16 AliSecGuard
crw------- 1 root root 10, 235 Feb 25 16:09 autofs
drwxr-xr-x 2 root root 80 Feb 25 16:09 block
crw------- 1 root root 10, 234 Feb 25 16:09 btrfs-control
drwxr-xr-x 3 root root 60 Feb 25 16:09 bus
drwxr-xr-x 2 root root 2740 Mar 3 09:38 char
crw------- 1 root root 5, 1 Feb 25 16:09 console
lrwxrwxrwx 1 root root 11 Feb 25 16:09 core -> /proc/kcore
drwxr-xr-x 4 root root 80 Feb 25 16:09 cpu
crw------- 1 root root 10, 61 Feb 25 16:09 cpu_dma_latency
crw------- 1 root root 10, 62 Feb 25 16:09 crash
drwxr-xr-x 5 root root 100 Feb 25 16:09 disk
drwxr-xr-x 2 root root 60 Feb 25 16:09 dri
crw-rw---- 1 root video 29, 0 Feb 25 16:09 fb0
lrwxrwxrwx 1 root root 13 Feb 25 16:09 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Feb 25 16:09 full
crw-rw-rw- 1 root root 10, 229 Mar 3 09:38 fuse
crw------- 1 root root 246, 0 Feb 25 16:09 hidraw0
crw------- 1 root root 243, 0 Feb 25 20:28 hids_driver_allowlist
crw------- 1 root root 10, 228 Feb 25 16:09 hpet
drwxr-xr-x 2 root root 0 Feb 25 16:09 hugepages
crw------- 1 root root 10, 183 Feb 25 16:09 hwrng
lrwxrwxrwx 1 root root 25 Feb 25 16:09 initctl -> /run/systemd/initctl/fifo
drwxr-xr-x 4 root root 320 Feb 25 16:09 input
crw-r--r-- 1 root root 1, 11 Feb 25 16:09 kmsg
srw-rw-rw- 1 root root 0 Feb 25 16:09 log
crw-rw---- 1 root disk 10, 237 Feb 25 16:09 loop-control
drwxr-xr-x 2 root root 60 Feb 25 16:09 mapper
crw------- 1 root root 10, 227 Feb 25 16:09 mcelog
crw-r----- 1 root kmem 1, 1 Feb 25 16:09 mem
drwxrwxrwt 2 root root 40 Feb 25 16:09 mqueue
drwxr-xr-x 2 root root 60 Feb 25 16:09 net
crw------- 1 root root 10, 60 Feb 25 16:09 network_latency
crw------- 1 root root 10, 59 Feb 25 16:09 network_throughput
crw-rw-rw- 1 root root 1, 3 Feb 25 16:09 null
crw------- 1 root root 10, 144 Feb 25 16:09 nvram
crw------- 1 root root 1, 12 Feb 25 16:09 oldmem
crw-r----- 1 root kmem 1, 4 Feb 25 16:09 port
crw------- 1 root root 108, 0 Feb 25 16:09 ppp
crw-rw-rw- 1 root tty 5, 2 Mar 6 10:44 ptmx
drwxr-xr-x 2 root root 0 Feb 25 16:09 pts
crw-rw-rw- 1 root root 1, 8 Feb 25 16:09 random
drwxr-xr-x 2 root root 60 Feb 25 16:09 raw
crw-rw-r-- 1 root root 10, 57 Feb 25 16:14 rfkill
lrwxrwxrwx 1 root root 4 Feb 25 16:09 rtc -> rtc0
crw------- 1 root root 252, 0 Feb 25 16:09 rtc0
drwxrwxrwt 2 root root 160 Mar 3 09:35 shm
crw------- 1 root root 10, 231 Feb 25 16:09 snapshot
drwxr-xr-x 2 root root 80 Feb 25 16:09 snd
lrwxrwxrwx 1 root root 15 Feb 25 16:09 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Feb 25 16:09 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Feb 25 16:09 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty 5, 0 Feb 25 16:09 tty
crw--w---- 1 root tty 4, 0 Feb 25 16:09 tty0
crw--w---- 1 root tty 4, 1 Feb 25 16:09 tty1
crw--w---- 1 root tty 4, 10 Feb 25 16:09 tty10
crw--w---- 1 root tty 4, 11 Feb 25 16:09 tty11
crw--w---- 1 root tty 4, 12 Feb 25 16:09 tty12
crw--w---- 1 root tty 4, 13 Feb 25 16:09 tty13
crw--w---- 1 root tty 4, 14 Feb 25 16:09 tty14
crw--w---- 1 root tty 4, 15 Feb 25 16:09 tty15
crw--w---- 1 root tty 4, 16 Feb 25 16:09 tty16
crw--w---- 1 root tty 4, 17 Feb 25 16:09 tty17
crw--w---- 1 root tty 4, 18 Feb 25 16:09 tty18
crw--w---- 1 root tty 4, 19 Feb 25 16:09 tty19
crw--w---- 1 root tty 4, 2 Feb 25 16:09 tty2
crw--w---- 1 root tty 4, 20 Feb 25 16:09 tty20
crw--w---- 1 root tty 4, 21 Feb 25 16:09 tty21
crw--w---- 1 root tty 4, 22 Feb 25 16:09 tty22
crw--w---- 1 root tty 4, 23 Feb 25 16:09 tty23
crw--w---- 1 root tty 4, 24 Feb 25 16:09 tty24
crw--w---- 1 root tty 4, 25 Feb 25 16:09 tty25
crw--w---- 1 root tty 4, 26 Feb 25 16:09 tty26
crw--w---- 1 root tty 4, 27 Feb 25 16:09 tty27
crw--w---- 1 root tty 4, 28 Feb 25 16:09 tty28
crw--w---- 1 root tty 4, 29 Feb 25 16:09 tty29
crw--w---- 1 root tty 4, 3 Feb 25 16:09 tty3
crw--w---- 1 root tty 4, 30 Feb 25 16:09 tty30
crw--w---- 1 root tty 4, 31 Feb 25 16:09 tty31
crw--w---- 1 root tty 4, 32 Feb 25 16:09 tty32
crw--w---- 1 root tty 4, 33 Feb 25 16:09 tty33
crw--w---- 1 root tty 4, 34 Feb 25 16:09 tty34
crw--w---- 1 root tty 4, 35 Feb 25 16:09 tty35
crw--w---- 1 root tty 4, 36 Feb 25 16:09 tty36
crw--w---- 1 root tty 4, 37 Feb 25 16:09 tty37
crw--w---- 1 root tty 4, 38 Feb 25 16:09 tty38
crw--w---- 1 root tty 4, 39 Feb 25 16:09 tty39
crw--w---- 1 root tty 4, 4 Feb 25 16:09 tty4
crw--w---- 1 root tty 4, 40 Feb 25 16:09 tty40
crw--w---- 1 root tty 4, 41 Feb 25 16:09 tty41
crw--w---- 1 root tty 4, 42 Feb 25 16:09 tty42
crw--w---- 1 root tty 4, 43 Feb 25 16:09 tty43
crw--w---- 1 root tty 4, 44 Feb 25 16:09 tty44
crw--w---- 1 root tty 4, 45 Feb 25 16:09 tty45
crw--w---- 1 root tty 4, 46 Feb 25 16:09 tty46
crw--w---- 1 root tty 4, 47 Feb 25 16:09 tty47
crw--w---- 1 root tty 4, 48 Feb 25 16:09 tty48
crw--w---- 1 root tty 4, 49 Feb 25 16:09 tty49
crw--w---- 1 root tty 4, 5 Feb 25 16:09 tty5
crw--w---- 1 root tty 4, 50 Feb 25 16:09 tty50
crw--w---- 1 root tty 4, 51 Feb 25 16:09 tty51
crw--w---- 1 root tty 4, 52 Feb 25 16:09 tty52
crw--w---- 1 root tty 4, 53 Feb 25 16:09 tty53
crw--w---- 1 root tty 4, 54 Feb 25 16:09 tty54
crw--w---- 1 root tty 4, 55 Feb 25 16:09 tty55
crw--w---- 1 root tty 4, 56 Feb 25 16:09 tty56
crw--w---- 1 root tty 4, 57 Feb 25 16:09 tty57
crw--w---- 1 root tty 4, 58 Feb 25 16:09 tty58
crw--w---- 1 root tty 4, 59 Feb 25 16:09 tty59
crw--w---- 1 root tty 4, 6 Feb 25 16:09 tty6
crw--w---- 1 root tty 4, 60 Feb 25 16:09 tty60
crw--w---- 1 root tty 4, 61 Feb 25 16:09 tty61
crw--w---- 1 root tty 4, 62 Feb 25 16:09 tty62
crw--w---- 1 root tty 4, 63 Feb 25 16:09 tty63
crw--w---- 1 root tty 4, 7 Feb 25 16:09 tty7
crw--w---- 1 root tty 4, 8 Feb 25 16:09 tty8
crw--w---- 1 root tty 4, 9 Feb 25 16:09 tty9
crw--w---- 1 root tty 4, 64 Feb 25 16:09 ttyS0
crw-rw---- 1 root dialout 4, 65 Feb 25 16:09 ttyS1
crw-rw---- 1 root dialout 4, 66 Feb 25 16:09 ttyS2
crw-rw---- 1 root dialout 4, 67 Feb 25 16:09 ttyS3
crw------- 1 root root 10, 239 Feb 25 16:09 uhid
crw------- 1 root root 10, 223 Feb 25 16:09 uinput
crw-rw-rw- 1 root root 1, 9 Feb 25 16:09 urandom
crw------- 1 root root 247, 0 Feb 25 16:09 usbmon0
crw------- 1 root root 247, 1 Feb 25 16:09 usbmon1
crw-rw---- 1 root tty 7, 0 Feb 25 16:09 vcs
crw-rw---- 1 root tty 7, 1 Feb 25 16:09 vcs1
crw-rw---- 1 root tty 7, 2 Feb 25 16:09 vcs2
crw-rw---- 1 root tty 7, 3 Feb 25 16:09 vcs3
crw-rw---- 1 root tty 7, 4 Feb 25 16:09 vcs4
crw-rw---- 1 root tty 7, 5 Feb 25 16:09 vcs5
crw-rw---- 1 root tty 7, 6 Feb 25 16:09 vcs6
crw-rw---- 1 root tty 7, 128 Feb 25 16:09 vcsa
crw-rw---- 1 root tty 7, 129 Feb 25 16:09 vcsa1
crw-rw---- 1 root tty 7, 130 Feb 25 16:09 vcsa2
crw-rw---- 1 root tty 7, 131 Feb 25 16:09 vcsa3
crw-rw---- 1 root tty 7, 132 Feb 25 16:09 vcsa4
crw-rw---- 1 root tty 7, 133 Feb 25 16:09 vcsa5
crw-rw---- 1 root tty 7, 134 Feb 25 16:09 vcsa6
brw-rw---- 1 root disk 253, 0 Feb 25 16:09 vda
brw-rw---- 1 root disk 253, 1 Feb 25 16:09 vda1
drwxr-xr-x 2 root root 60 Feb 25 16:09 vfio
crw------- 1 root root 10, 63 Feb 25 16:09 vga_arbiter
crw------- 1 root root 10, 137 Feb 25 16:09 vhci
crw------- 1 root root 10, 238 Feb 25 16:09 vhost-net
drwxr-xr-x 2 root root 60 Feb 25 16:09 virtio-ports
crw------- 1 root root 244, 1 Feb 25 16:09 vport1p1
crw-rw-rw- 1 root root 1, 5 Feb 25 16:09 zero
Hyper-V环境
$ ls -l /dev
total 0
crw-r--r-- 1 root root 10, 235 Mar 5 21:00 autofs
drwxr-xr-x 2 root root 260 Mar 5 21:00 block
drwxr-xr-x 2 root root 60 Mar 6 2024 bsg
crw------- 1 root root 10, 234 Mar 6 2024 btrfs-control
drwxr-xr-x 2 root root 2680 Mar 5 21:00 char
crw--w---- 1 root tty 5, 1 Mar 6 2024 console
lrwxrwxrwx 1 root root 11 Mar 6 2024 core -> /proc/kcore
crw------- 1 root root 10, 125 Mar 5 21:00 cpu_dma_latency
crw------- 1 root root 10, 203 Mar 6 2024 cuse
drwxr-xr-x 9 root root 180 Mar 6 2024 disk
drwxr-xr-x 2 root root 60 Mar 6 2024 dri
crw-rw---- 1 root video 29, 0 Mar 5 21:00 fb0
lrwxrwxrwx 1 root root 13 Mar 6 2024 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Mar 5 21:00 full
crw-rw-rw- 1 root root 10, 229 Mar 5 21:00 fuse
crw------- 1 root root 10, 228 Mar 5 21:00 hpet
drwxr-xr-x 2 root root 0 Mar 6 2024 hugepages
crw------- 1 root root 10, 183 Mar 5 21:00 hwrng
lrwxrwxrwx 1 root root 12 Mar 6 2024 initctl -> /run/initctl
drwxr-xr-x 3 root root 180 Mar 5 21:00 input
crw-r--r-- 1 root root 1, 11 Mar 5 21:00 kmsg
lrwxrwxrwx 1 root root 28 Mar 6 2024 log -> /run/systemd/journal/dev-log
brw-rw---- 1 root disk 7, 0 Mar 6 2024 loop0
brw-rw---- 1 root disk 7, 1 Mar 6 2024 loop1
brw-rw---- 1 root disk 7, 2 Mar 6 2024 loop2
brw-rw---- 1 root disk 7, 3 Mar 6 2024 loop3
brw-rw---- 1 root disk 7, 4 Mar 6 2024 loop4
brw-rw---- 1 root disk 7, 5 Mar 6 2024 loop5
brw-rw---- 1 root disk 7, 6 Mar 6 2024 loop6
brw-rw---- 1 root disk 7, 7 Mar 6 2024 loop7
crw-rw---- 1 root disk 10, 237 Mar 5 21:00 loop-control
drwxr-xr-x 2 root root 60 Mar 6 2024 mapper
crw-r----- 1 root kmem 1, 1 Mar 5 21:00 mem
drwxrwxrwt 2 root root 40 Mar 6 2024 mqueue
drwxr-xr-x 2 root root 60 Mar 6 2024 net
crw-rw-rw- 1 root root 1, 3 Mar 5 21:00 null
crw------- 1 root root 10, 144 Mar 6 2024 nvram
crw-r----- 1 root kmem 1, 4 Mar 5 21:00 port
crw------- 1 root root 108, 0 Mar 6 2024 ppp
crw------- 1 root root 10, 1 Mar 5 21:00 psaux
crw-rw-rw- 1 root tty 5, 2 Mar 5 21:45 ptmx
crw------- 1 root root 248, 0 Mar 5 21:00 ptp0
lrwxrwxrwx 1 root root 4 Mar 5 21:00 ptp_hyperv -> ptp0
drwxr-xr-x 2 root root 0 Mar 6 2024 pts
crw-rw-rw- 1 root root 1, 8 Mar 5 21:00 random
crw-rw-r--+ 1 root netdev 10, 242 Mar 5 21:00 rfkill
lrwxrwxrwx 1 root root 4 Mar 6 2024 rtc -> rtc0
crw------- 1 root root 250, 0 Mar 5 21:00 rtc0
brw-rw---- 1 root disk 8, 0 Mar 5 21:00 sda
brw-rw---- 1 root disk 8, 1 Mar 5 21:00 sda1
brw-rw---- 1 root disk 8, 2 Mar 5 21:00 sda2
crw-rw---- 1 root disk 21, 0 Mar 5 21:00 sg0
drwxrwxrwt 2 root root 40 Mar 6 2024 shm
crw------- 1 root root 10, 231 Mar 5 21:00 snapshot
drwxr-xr-x 2 root root 80 Mar 6 2024 snd
lrwxrwxrwx 1 root root 15 Mar 6 2024 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Mar 6 2024 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Mar 6 2024 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty 5, 0 Mar 5 21:18 tty
crw--w---- 1 root tty 4, 0 Mar 6 2024 tty0
crw--w---- 1 root tty 4, 1 Mar 5 21:00 tty1
crw--w---- 1 root tty 4, 10 Mar 6 2024 tty10
crw--w---- 1 root tty 4, 11 Mar 6 2024 tty11
crw--w---- 1 root tty 4, 12 Mar 6 2024 tty12
crw--w---- 1 root tty 4, 13 Mar 6 2024 tty13
crw--w---- 1 root tty 4, 14 Mar 6 2024 tty14
crw--w---- 1 root tty 4, 15 Mar 6 2024 tty15
crw--w---- 1 root tty 4, 16 Mar 6 2024 tty16
crw--w---- 1 root tty 4, 17 Mar 6 2024 tty17
crw--w---- 1 root tty 4, 18 Mar 6 2024 tty18
crw--w---- 1 root tty 4, 19 Mar 6 2024 tty19
crw--w---- 1 root tty 4, 2 Mar 5 21:00 tty2
crw--w---- 1 root tty 4, 20 Mar 6 2024 tty20
crw--w---- 1 root tty 4, 21 Mar 6 2024 tty21
crw--w---- 1 root tty 4, 22 Mar 6 2024 tty22
crw--w---- 1 root tty 4, 23 Mar 6 2024 tty23
crw--w---- 1 root tty 4, 24 Mar 6 2024 tty24
crw--w---- 1 root tty 4, 25 Mar 6 2024 tty25
crw--w---- 1 root tty 4, 26 Mar 6 2024 tty26
crw--w---- 1 root tty 4, 27 Mar 6 2024 tty27
crw--w---- 1 root tty 4, 28 Mar 6 2024 tty28
crw--w---- 1 root tty 4, 29 Mar 6 2024 tty29
crw--w---- 1 root tty 4, 3 Mar 5 21:00 tty3
crw--w---- 1 root tty 4, 30 Mar 6 2024 tty30
crw--w---- 1 root tty 4, 31 Mar 6 2024 tty31
crw--w---- 1 root tty 4, 32 Mar 6 2024 tty32
crw--w---- 1 root tty 4, 33 Mar 6 2024 tty33
crw--w---- 1 root tty 4, 34 Mar 6 2024 tty34
crw--w---- 1 root tty 4, 35 Mar 6 2024 tty35
crw--w---- 1 root tty 4, 36 Mar 6 2024 tty36
crw--w---- 1 root tty 4, 37 Mar 6 2024 tty37
crw--w---- 1 root tty 4, 38 Mar 6 2024 tty38
crw--w---- 1 root tty 4, 39 Mar 6 2024 tty39
crw--w---- 1 root tty 4, 4 Mar 5 21:00 tty4
crw--w---- 1 root tty 4, 40 Mar 6 2024 tty40
crw--w---- 1 root tty 4, 41 Mar 6 2024 tty41
crw--w---- 1 root tty 4, 42 Mar 6 2024 tty42
crw--w---- 1 root tty 4, 43 Mar 6 2024 tty43
crw--w---- 1 root tty 4, 44 Mar 6 2024 tty44
crw--w---- 1 root tty 4, 45 Mar 6 2024 tty45
crw--w---- 1 root tty 4, 46 Mar 6 2024 tty46
crw--w---- 1 root tty 4, 47 Mar 6 2024 tty47
crw--w---- 1 root tty 4, 48 Mar 6 2024 tty48
crw--w---- 1 root tty 4, 49 Mar 6 2024 tty49
crw--w---- 1 root tty 4, 5 Mar 5 21:00 tty5
crw--w---- 1 root tty 4, 50 Mar 6 2024 tty50
crw--w---- 1 root tty 4, 51 Mar 6 2024 tty51
crw--w---- 1 root tty 4, 52 Mar 6 2024 tty52
crw--w---- 1 root tty 4, 53 Mar 6 2024 tty53
crw--w---- 1 root tty 4, 54 Mar 6 2024 tty54
crw--w---- 1 root tty 4, 55 Mar 6 2024 tty55
crw--w---- 1 root tty 4, 56 Mar 6 2024 tty56
crw--w---- 1 root tty 4, 57 Mar 6 2024 tty57
crw--w---- 1 root tty 4, 58 Mar 6 2024 tty58
crw--w---- 1 root tty 4, 59 Mar 6 2024 tty59
crw--w---- 1 root tty 4, 6 Mar 5 21:00 tty6
crw--w---- 1 root tty 4, 60 Mar 6 2024 tty60
crw--w---- 1 root tty 4, 61 Mar 6 2024 tty61
crw--w---- 1 root tty 4, 62 Mar 6 2024 tty62
crw--w---- 1 root tty 4, 63 Mar 6 2024 tty63
crw--w---- 1 root tty 4, 7 Mar 5 21:00 tty7
crw--w---- 1 root tty 4, 8 Mar 6 2024 tty8
crw--w---- 1 root tty 4, 9 Mar 6 2024 tty9
crw-rw---- 1 root dialout 4, 64 Mar 6 2024 ttyS0
crw-rw---- 1 root dialout 4, 65 Mar 6 2024 ttyS1
crw-rw---- 1 root dialout 4, 66 Mar 6 2024 ttyS2
crw-rw---- 1 root dialout 4, 67 Mar 6 2024 ttyS3
crw------- 1 root root 10, 239 Mar 6 2024 uhid
crw------- 1 root root 10, 223 Mar 6 2024 uinput
crw-rw-rw- 1 root root 1, 9 Mar 5 21:00 urandom
crw------- 1 root root 10, 126 Mar 5 21:00 userfaultfd
crw-rw---- 1 root tty 7, 0 Mar 5 21:00 vcs
crw-rw---- 1 root tty 7, 1 Mar 5 21:00 vcs1
crw-rw---- 1 root tty 7, 2 Mar 5 21:00 vcs2
crw-rw---- 1 root tty 7, 3 Mar 5 21:00 vcs3
crw-rw---- 1 root tty 7, 4 Mar 5 21:00 vcs4
crw-rw---- 1 root tty 7, 5 Mar 5 21:00 vcs5
crw-rw---- 1 root tty 7, 6 Mar 5 21:00 vcs6
crw-rw---- 1 root tty 7, 7 Mar 5 21:00 vcs7
crw-rw---- 1 root tty 7, 128 Mar 5 21:00 vcsa
crw-rw---- 1 root tty 7, 129 Mar 5 21:00 vcsa1
crw-rw---- 1 root tty 7, 130 Mar 5 21:00 vcsa2
crw-rw---- 1 root tty 7, 131 Mar 5 21:00 vcsa3
crw-rw---- 1 root tty 7, 132 Mar 5 21:00 vcsa4
crw-rw---- 1 root tty 7, 133 Mar 5 21:00 vcsa5
crw-rw---- 1 root tty 7, 134 Mar 5 21:00 vcsa6
crw-rw---- 1 root tty 7, 135 Mar 5 21:00 vcsa7
crw-rw---- 1 root tty 7, 64 Mar 5 21:00 vcsu
crw-rw---- 1 root tty 7, 65 Mar 5 21:00 vcsu1
crw-rw---- 1 root tty 7, 66 Mar 5 21:00 vcsu2
crw-rw---- 1 root tty 7, 67 Mar 5 21:00 vcsu3
crw-rw---- 1 root tty 7, 68 Mar 5 21:00 vcsu4
crw-rw---- 1 root tty 7, 69 Mar 5 21:00 vcsu5
crw-rw---- 1 root tty 7, 70 Mar 5 21:00 vcsu6
crw-rw---- 1 root tty 7, 71 Mar 5 21:00 vcsu7
drwxr-xr-x 2 root root 60 Mar 6 2024 vfio
crw------- 1 root root 10, 127 Mar 5 21:00 vga_arbiter
crw------- 1 root root 10, 137 Mar 6 2024 vhci
crw-rw---- 1 root kvm 10, 238 Mar 6 2024 vhost-net
crw-rw---- 1 root kvm 10, 241 Mar 6 2024 vhost-vsock
drwxr-xr-x 2 root root 80 Mar 6 2024 vmbus
crw-rw-rw- 1 root root 10, 124 Mar 5 21:00 vsock
crw-rw-rw- 1 root root 1, 5 Mar 5 21:00 zero
3. 查看硬盘信息
容器一般默认没有分区。通过查看分区表也可以判断。
各环境下实验
Docker环境
# fdisk -l
#
WSL环境
$ fdisk -l
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/loop0: 457.74 MiB, 479973376 bytes, 937448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 145.56 MiB, 152635392 bytes, 298116 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 689.08 MiB, 722550784 bytes, 1411232 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 389.82 MiB, 408756224 bytes, 798352 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 4 GiB, 4294971392 bytes, 8388616 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sdc: 1 TiB, 1099511627776 bytes, 2147483648 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sdd: 1 TiB, 1099511627776 bytes, 2147483648 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sde: 1 TiB, 1099511627776 bytes, 2147483648 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
ECS环境
# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bdc9e
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83886046 41941999+ 83 Linux
Hyper-V环境
$ sudo fdisk -l
[sudo] password for kali:
Disk /dev/sda: 80.09 GiB, 86000000000 bytes, 167968750 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: EAFC86EE-6595-4E48-8D83-9DFC62C74283
Device Start End Sectors Size Type
/dev/sda1 34 1000000 999967 488.3M EFI System
/dev/sda2 1000001 167968716 166968716 79.6G Linux filesystem
4. 查看文件系统以及挂载点
docker一般使用overlay或者aufs文件系统,所以筛选使用这类文件系统的磁盘,可以帮助判断。
df -h | egrep '(overlay|aufs)'
各环境下实验
Docker环境
# df -h | egrep '(overlay|aufs)'
overlay 1007G 7.5G 949G 1% /
WSL环境
$ df -h | egrep '(overlay|aufs)'
ECS环境
# df -h | egrep '(overlay|aufs)'
Hyper-V环境
$ df -h | egrep '(overlay|aufs)'
知识点
1)overlay文件系统
Overlay文件系统(OverlayFS)是Linux内核中的一个联合文件系统,它可以将多个源目录(称为“lowerdir”)叠加到一个统一的目录上,并通过一个额外的目录(称为“upperdir”)来存储修改。简而言之,OverlayFS允许用户在一个只读的底层文件系统之上,创建一个可写的上层文件系统,以实现对底层文件系统的修改,而无需真正更改底层数据。
2)df和egrep命令
Linux df(英文全拼:disk free) 命令用于显示目前在 Linux 系统上的文件系统磁盘使用情况统计。
Linux egrep命令用于在文件内查找指定的字符串。egrep是用extended regular expression语法来解读的,而grep则用basic regular expression 语法解读,extended regular expression比basic regular expression的表达更规范。
3 使用工具
3.1 通过systemd-detect-virt指令
systemd-detect-virt
是一个 Linux 系统中的命令行工具,它的主要作用是检测当前系统是否运行在一个虚拟化环境中,以及进一步确定是哪种类型的虚拟化环境。这个工具是 systemd
工具集中的一部分。
当运行 systemd-detect-virt
命令时,它会尝试检测并返回关于系统虚拟化环境的信息。这包括检测系统是否运行在虚拟机(如 KVM、QEMU、VMware、Xen 等)或容器(如 LXC、Docker、OpenVZ 等)内。如果检测成功,该命令将返回虚拟化技术的简短标识;如果未检测到虚拟化环境,则可能返回 "none"。
3.1.1 各环境下实验
Docker环境
# systemd-detect-virt
/bin/sh: 5: systemd-detect-virt: not found
Docker容器里面是没有 systemd 进程的,所以不能正常使用指令。
WSL环境
$ systemd-detect-virt
wsl
ECS环境
# systemd-detect-virt
kvm
Hyper-V环境
$ systemd-detect-virt
microsoft
- 0
- 0
-
分享