【问题标题】:dockerd init script in fedoraFedora 中的 dockerd 初始化脚本
【发布时间】:2017-07-18 22:58:22
【问题描述】:

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

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

Docker 版本:

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 初始化脚本,或者您能建议如何编写一个新脚本?

【问题讨论】:

    标签: shell docker daemon init fedora-25


    【解决方案1】:

    我自己找出解决办法

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

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

    docker.service:

        [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 在系统启动时启动。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-23
      • 1970-01-01
      • 2011-10-19
      相关资源
      最近更新 更多