0

我需要dockerd在 Fedora 25 的系统引导期间启动。

我已经安装docker-engine在 Fedora 25 服务器版中。

码头工人版本:

Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:58:06 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:58:06 2017
 OS/Arch:      linux/amd64
 Experimental: false

我已经通过自定义位置存储了 docker 文件,所以我曾经为以下方法启动dockerd

dockerd -g /u01/docker 

我看到这个初始化脚本 init1init2 但是,它们只启动docker,我需要使用自定义位置启动 dockerd

喜欢:

dockerd -g /u01/docker

我如何更改该 github 初始化脚本,或者您能建议如何编写一个新脚本?

4

1 回答 1

1

我自己找出解决方案

我找到默认的 docker.service 文件并更改为我们的自定义位置路径

我添加了这一行ExecStart=/usr/bin/dockerd -g /u01/docker而不是ExecStart=/usr/bin/dockerd

码头工人服务:

    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    After=network.target firewalld.service

    [Service]
    Type=notify
    # the default is not to use systemd for cgroups because the delegate issues still
    # exists and systemd currently does not support the cgroup feature set required
    # for containers run by docker
    ExecStart=/usr/bin/dockerd -g /u01/docker
    ExecReload=/bin/kill -s HUP $MAINPID
    # Having non-zero Limit*s causes performance problems due to accounting overhead
    # in the kernel. We recommend using cgroups to do container-local accounting.
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    # Uncomment TasksMax if your systemd version supports it.
    # Only systemd 226 and above support this version.
    #TasksMax=infinity
    TimeoutStartSec=0
    # set delegate yes so that systemd does not reset the cgroups of docker containers
    Delegate=yes
    # kill only the docker process, not all processes in the cgroup
    KillMode=process

    [Install]
    WantedBy=multi-user.target

之后我跑

sytemctl daemon-reload
systemctl enable docker.service 
systemctl start docker.service 

现在, docker start 在系统启动时启动。

于 2017-02-28T07:03:53.560 回答