在Linux上启用Overlay,一般指启用Overlay文件系统,步骤如下:
sudo apt-get update和sudo apt-get install overlayroot;在CentOS/RHEL上,执行sudo yum install overlay。mkdir -p /mnt/overlay/{lower,upper,work}。echo "This is a file in the lower layer" > /mnt/overlay/lower/file.txt。mount命令挂载,语法为sudo mount -t overlay overlay -o lowerdir=/mnt/overlay/lower,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /mnt/overlay/merged。df -h /mnt/overlay/merged命令查看挂载是否成功。若要启用Overlay网络,步骤如下:
sudo apt-get update和sudo apt-get install docker.io安装Docker。/etc/docker/daemon.json文件,添加{"storage-driver": "overlay2"},然后重启Docker服务。docker network create --driver overlay my_overlay_network命令创建网络。