vik*_*ava 7 docker docker-compose
当我尝试使用以下命令启动 docker 时:
sudo systemctl start docker
Run Code Online (Sandbox Code Playgroud)
我遇到以下错误
Failed to start docker.service: Unit not found.
Run Code Online (Sandbox Code Playgroud)
我尝试在网上找到一些建议来解决此问题并遵循,但它没有解决问题。
这是我的 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
Run Code Online (Sandbox Code Playgroud)
这是我在启动 docker.socket 时遇到的错误
sudo systemctl start docker.socket
See "systemctl status docker.socket" and "journalctl -xe" for details.
Run Code Online (Sandbox Code Playgroud)
“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.
Run Code Online (Sandbox Code Playgroud)
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?
Run Code Online (Sandbox Code Playgroud)
对我来说, docker.service 似乎是一个问题。您能否建议我如何解决它?
小智 4
应该有一个 docker.service 单元文件/lib/systemd/system或处/etc/systemd/system。我的看起来如下所示。
如果您在那里有一个,您可以尝试通过以下方式确保它已启用:
sudo systemctl enable docker.service
Run Code Online (Sandbox Code Playgroud)
这是 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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25036 次 |
| 最近记录: |