如何为 docker 守护程序传递附加参数

How to pass additional arguments for docker daemon

我在/etc/sysconfig/docker下,配置如下:-

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

现在我在 Red Hat Enterprise Linux 服务器版本 7.4 和默认存储驱动程序上使用 docker 版本 17.03.1-ce 和默认存储驱动程序作为覆盖,由于 :-

checksum_type: too many links

在互联网上做了一些研究后发现最好的解决方案是使用 overlay2 驱动程序。

如何编辑 /etc/sysconfig/docker 以将存储驱动程序包含在 overlay2 中。我尝试了很多方法,但 none 奏效了。

如有任何帮助,我们将一如既往地不胜感激。

基于 the documentation,您可以将 -s overlay2 传递给 docker 守护程序。

你的 other_args 应该是这样的:

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

我在 Red Hat Enterprise 7 上使用 Docker Enterprise Edition,因此不支持覆盖,但在文档的 Docker documentation for the Overlay File System, it says to add a section in the /etc/docker/daemon.json file (which I had to create). This section 中解释了如何配置 overlay2。

  1. 通过运行sudo systemctl stop docker停止docker。

  2. 通过 运行 cp /var/lib/docker /var/lib/docker.backup 创建 Docker 的本地存储 (/var/lib/docker) 的备份。文档说:

    If you want to use a separate backing filesystem from the one used by /var/lib/, format the filesystem and mount it into /var/lib/docker. Make sure add this mount to /etc/fstab to make it permanent.

  3. 然后在创建后编辑 /etc/docker/daemon.json(如果尚不存在)。添加:

    {
        "storage-driver": "overlay2"
    }
    
  4. 从 docker 开始 sudo systemctl start docker

  5. 检查文件系统是否被 运行 docker info 更改并检查 storage driverbacking filesystem 部分

创建了一个文件 /etc/docker/daemon.json 包含:-

{

"storage-driver": "overlay2",

"storage-opts": [

"overlay2.override_kernel_check=true" ] }

成功了