我需要在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
我看到这个初始化脚本init1和init2但是,他们只启动了泊坞窗,我需要使用自定义位置启动dockerd
像:
dockerd -g /u01/docker
如何更改github init脚本,或者您可以建议如何编写新脚本吗?
答案 0 :(得分: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在系统启动时启动。