[英]How to configure systemctl service for docker installed from binaries?
I installed docker from binaries on SLES 15 x86_64 ( https://docs.docker.com/engine/install/binaries/#install-static-binaries ).我从 SLES 15 x86_64 ( https://docs.docker.com/engine/install/binaries/#install-static-binaries ) 上的二进制文件安装了 docker。 And now I need to configure boot on start up and rootless launch.
现在我需要在启动和无根启动时配置引导。 But I have no docker.service.
但我没有 docker.service。 And I don't understand how to configure it manually.
而且我不明白如何手动配置它。
Thank you.谢谢你。
Normally I'd suggest to enable Container Module 12 x86_64
(aka sle-module-containers/12/x86_64
) as described here but I think you have your reasons for not using it.通常,我建议按照此处所述启用
Container Module 12 x86_64
(又名sle-module-containers/12/x86_64
),但我认为您有理由不使用它。
You need to create the docker.service
and docker.socket
files in the /etc/systemd/system
folder as described in the documentation .您需要创建
docker.service
和docker.socket
中的文件/etc/systemd/system
的描述文件夹中的文件。
docker.service
content can found here and it's currently: docker.service
内容可以在这里找到,目前是:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service
Wants=network-online.target containerd.service
Requires=docker.socket
[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 -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# 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
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# 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
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target
docker.socket
can be found here and it's currently: docker.socket
可以在这里找到,它目前是:
[Unit]
Description=Docker Socket for the API
[Socket]
# If /var/run is not implemented as a symlink to /run, you may need to
# specify ListenStream=/var/run/docker.sock instead.
ListenStream=/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.