联合挂载
演示
mkdir /lower{1,2,3} mkdir /upper /work /merged mount -t overlay overlay -o lowerdir=/lower1:/lower2:/lower3,upperdir=/upper,workdir=/work /merged df -h touch /merged/123.txt ls -l /upper/ ls -l /lower* umount /merged mount -t overlay overlay -o lowerdir=/lower1:/lower2:/lower3,workdir=/work /merged touch /merged/456.txt # touch: cannot touch ‘/merged/456.txt‘: Read-only file system
/merged 目录作为入口, /upper 是可读写目录, /lower* 是只读目录、对应的是镜像内的目录是不可修改的内容