dockerd init脚本在Fedora中

我需要在Fedora 25的系统启动过程中启动dockerd

我在Fedora 25 Server Edition中安装了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 

我看到这个init脚本init1和init2但是,他们只启动泊坞窗, 我需要启动dockerd自定义位置

喜欢:

 dockerd -g /u01/docker 

我怎样才能改变这个github初始化脚本,或者你能build议如何编写一个新脚本?

我自己找出解决办法

我find默认的docker.service文件,并更改为我们的自定义位置path

我添加了这行ExecStart=/usr/bin/dockerd -g /u01/docker ExecStart=/usr/bin/dockerd而不是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在系统启动时启动。