You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何编辑/etc/sysconfig/docker配置Docker守护进程切换至overlay2存储驱动

Switch Docker Storage Driver from overlay to overlay2 on RHEL 7.4 (Docker 17.03.1-ce)

Let's walk through the exact steps to update your /etc/sysconfig/docker config and switch to overlay2—this should fix that frustrating checksum_type: too many links error plaguing your builds.

Step 1: Stop Docker Service First

Before making any config changes, shut down Docker completely to avoid runtime conflicts:

sudo systemctl stop docker

Quickly double-check no containers are running with docker ps -a—if you have critical containers or images, back them up first using docker save or commit containers to images.

Step 2: Update the /etc/sysconfig/docker File

Open the config file with your preferred editor (e.g., vim or nano):

sudo vi /etc/sysconfig/docker

Locate your existing other_args line. All you need to do is add the --storage-driver=overlay2 flag to the existing arguments. Your updated line should look like this:

other_args="--insecure-registry ******* -g /apps/var/lib --storage-driver=overlay2"

Save the file and exit the editor.

Step 3: Ensure the Overlay Kernel Module is Loaded

Overlay2 depends on the kernel's overlay module. Verify it's already loaded:

lsmod | grep overlay

If you get no output, load it manually:

sudo modprobe overlay

To keep this module loaded across reboots, create a modules-load config file:

echo "overlay" | sudo tee /etc/modules-load.d/overlay.conf

Step 4: Clean Up Existing Docker Storage (Critical!)

Switching storage drivers requires clearing out the old overlay data—otherwise Docker will throw startup errors. Warning: This deletes all existing images, containers, volumes, and networks—back up anything important first!

sudo rm -rf /apps/var/lib/docker

This path matches the -g /apps/var/lib flag in your config, which defines Docker's root storage directory.

Step 5: Start Docker and Verify the Change

Restart Docker to apply the new config:

sudo systemctl start docker

Confirm the storage driver is now overlay2:

docker info | grep "Storage Driver"

You should see output like:

Storage Driver: overlay2

Key Notes to Remember

  • XFS Filesystem Check: Overlay2 requires the underlying filesystem to be XFS with ftype=1 enabled. Verify this for your /apps mount:
    xfs_info /apps | grep ftype
    
    If ftype=1 isn't present, you'll need to reformat the filesystem with this option (this is destructive, so plan carefully).
  • Compatibility: Your Docker version (17.03.1-ce) fully supports overlay2 on RHEL 7.4, so no version-related issues here.

内容的提问来源于stack exchange,提问作者Ashley

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:35:06