gpt4 book ai didi

docker 未启动并且失败并出现错误,无法启动 docker.service : Unit not found

转载 作者:行者123 更新时间:2023-12-02 19:45:15 24 4
gpt4 key购买 nike

当我尝试使用以下命令启动 docker 时:

sudo systemctl start docker 
我得到以下错误
Failed to start docker.service: Unit not found.
我尝试在网上找到一些建议来解决这个问题并遵循了这个建议,但它没有解决这个问题。

Cannot start docker daemon in CentOS7


这是我的 docker.socket 文件 [这只是其中一个答案的复制粘贴]
[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target
这是我在启动 docker.socket 时遇到错误的错误
sudo systemctl start docker.socket

See "systemctl status docker.socket" and "journalctl -xe" for details.
“systemctl status docker.socket”的输出
systemctl status docker.socket

systemd[1]: Socket service docker.service not loaded, refusing.
systemd[1]: Failed to listen on Docker Socket for the API.
docker 版本详情
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfca03
Built: Thu Aug 29 05:26:30 2019
OS/Arch: linux/amd64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
对我来说,docker.service 似乎是一个问题。你能否建议我如何解决它。

最佳答案

/lib/systemd/system 处应该有一个 docker.service 单元文件或 /etc/systemd/system .我的看起来像下面显示的那样。
如果您在那里有一个,您可以尝试通过以下方式确保它已启用:

sudo systemctl enable docker.service
这是 docker.service 单元文件的示例:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
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
TimeoutSec=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

[Install]
WantedBy=multi-user.target

关于docker 未启动并且失败并出现错误,无法启动 docker.service : Unit not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63878097/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com