如何在Redhat Linux 7现有Docker安装中切换为overlay2存储驱动
Let’s walk through the steps to switch your Docker storage driver to overlay2, which should resolve the checksum_type: too many links errors you’re facing with the legacy overlay driver.
Step 1: Stop the Docker service
First, shut down Docker safely to avoid data corruption during the change:
sudo systemctl stop docker
Step 2: Back up your Docker data
Always back up your existing Docker data before making configuration changes. Since your data is stored at /apps/var/lib/docker, run:
sudo cp -a /apps/var/lib/docker /apps/var/lib/docker.backup
This gives you a fallback if anything goes wrong during the switch.
Step 3: Update the /etc/sysconfig/docker file
Open the configuration file in your preferred editor (e.g., vi or nano):
sudo vi /etc/sysconfig/docker
Locate your existing other_args line:
other_args="--insecure-registry ******* -g /apps/var/lib"
Add the --storage-driver=overlay2 flag to this line. The updated line should look like:
other_args="--insecure-registry ******* -g /apps/var/lib --storage-driver=overlay2"
Save and close the file once you’re done editing.
Step 4: Start Docker and verify the change
Restart Docker to apply the new storage driver setting:
sudo systemctl start docker
Confirm the switch was successful by checking the active storage driver:
docker info | grep "Storage Driver"
You should see output like:
Storage Driver: overlay2
Key Notes
- Overlay2 is fully supported on RHEL 7.4 (kernel version 3.10.0-693+ included with RHEL 7.4) as long as your filesystem supports
d_type. For XFS (the default filesystem on RHEL 7), ensure it was formatted withftype=1(standard for RHEL 7.4 installations—verify withxfs_info /apps | grep ftype). - If you encounter issues after switching, revert by stopping Docker, restoring your backup (
sudo mv /apps/var/lib/docker.backup /apps/var/lib/docker), removing the--storage-driverflag fromother_args, and restarting Docker.
内容的提问来源于stack exchange,提问作者Ashley

