我已经安装了Docker yum install docker:
$ uname -a
Linux caspgval4 3.10.0-229.20.1.el7.x86_64 #1 SMP Wed Nov 4 10:08:36 CST 2015 x86_64 x86_64 x86_64 GNU/Linux
$ docker --version
Docker version 1.12.6, build 3a094bd/1.12.6
$ docker info
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
$ sudo systemctl status docker
? docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: http://docs.docker.com
Run Code Online (Sandbox Code Playgroud)
我正在尝试安装和运行Docker,但出现如下错误:
$ sudo service docker start
Redirecting to /bin/systemctl start docker.service
Failed to start docker.service: Unit not found.
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?我尝试了以下命令,但没有运气:
$ sudo systemctl start docker
Failed to start docker.service: Unit not found.
Run Code Online (Sandbox Code Playgroud)
额外的信息:
$ journalctl -u docker
No journal files were found.
-- No entries --
$ cat /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service
Requires=rhel-push-plugin.socket
Requires=docker-cleanup.timer
[Service]
Type=notify
NotifyAccess=all
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
Environment=DOCKER_HTTP_HOST_COMPAT=1
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
ExecStart=/usr/bin/dockerd-current \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--authorization-plugin=rhel-push-plugin \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
$OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
MountFlags=slave
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
我尝试了以下方法:
$ sudo systemctl daemon-reload
$ sudo systemctl start docker
Failed to start docker.service: Unit not found.
$ sudo journalctl -u docker
-- No entries --
Run Code Online (Sandbox Code Playgroud)
更多调试信息:
$ sudo systemctl status network.target
? network.target - Network
Loaded: loaded (/usr/lib/systemd/system/network.target; static; vendor preset: disabled)
Active: active since Mon 2017-01-23 02:54:39 PST; 2 months 29 days ago
Docs: man:systemd.special(7)
http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
Jan 23 02:54:39 mymachine systemd[1]: Starting Network.
Jan 23 02:54:39 mymachine systemd[1]: Reached target Network.
$ sudo systemctl status docker-storage-setup.service
? docker-storage-setup.service - Docker Storage Setup
Loaded: loaded (/usr/lib/systemd/system/docker-storage-setup.service; disabled; vendor preset: disabled)
Active: inactive (dead)
$ sudo systemctl status rhel-push-plugin.socket
Unit rhel-push-plugin.socket could not be found.
$ sudo systemctl status docker-cleanup.timer
? docker-cleanup.timer - Run docker-cleanup every hour
Loaded: loaded (/usr/lib/systemd/system/docker-cleanup.timer; disabled; vendor preset: disabled)
Active: inactive (dead)
Run Code Online (Sandbox Code Playgroud)
小智 28
如果你的操作系统是Ubuntu,使用以下命令即可成功安装Docker:
apt install docker.io
Run Code Online (Sandbox Code Playgroud)
Ama*_*ngh 21
如果有人使用 snap 安装了 docker,他们可以使用
sudo snap status docker #check the status
sudo snap start docker # start the service
Run Code Online (Sandbox Code Playgroud)
小智 13
运行此命令以列出所有服务:
sudo systemctl list-units --type=service
Run Code Online (Sandbox Code Playgroud)
查找正确的 Docker 服务名称(在我的例子中是snap.docker.dockerd.service),然后运行:
sudo systemctl restart snap.docker.dockerd.service
Run Code Online (Sandbox Code Playgroud)
BMi*_*tch 10
好像您缺少rhel-push-plugin.socket单元,该单元可能是rhel-push-plugin软件包的一部分。您可以尝试修复该安装,也可以直接从Docker以root用户身份安装上游Docker软件包:
curl -sSL https://get.docker.com/ | sh
Run Code Online (Sandbox Code Playgroud)
上游Docker安装将是Docker的较新版本,但不会进行各种rhel修改,例如rhel-push-plugin。
如果你已经使用 snap 安装了 docker,你可以像这样检查守护进程的状态:
sudo snap services docker
Run Code Online (Sandbox Code Playgroud)
如果该current列显示inactive,则表明它未运行。尝试用这个开始:
sudo snap start docker
Run Code Online (Sandbox Code Playgroud)
再次检查服务,如果之后仍然没有运行,您可以检查日志:
sudo snap logs docker
Run Code Online (Sandbox Code Playgroud)
这可能会提供更多有关阻止其运行的原因的提示
对我来说,我有一个错误,说 docker 无法创建符号链接,/etc/docker/因为另一个文件挡住了。由于 docker snap 中的已知错误,清空目录还不够。解决方法是删除目录,然后刷新快照(请参阅https://forum.snapcraft.io/t/layouts-still-brittle-when-refreshing-snaps/26252/2)
sudo rm -rf /etc/docker
sudo snap refresh
Run Code Online (Sandbox Code Playgroud)
小智 5
尝试运行此命令 -
sudo apt-get install containerd.io docker-ce
它将安装containerd运行时和docker.service的一些依赖项
然后尝试运行 -sudo systemctl list-units --type=service | grep "docker"
你会看到 docker.service 可用
然后检查状态-sudo service docker status
你就可以出发了!
小智 -5
尝试以 root 身份安装 Docker (sudo):
sudo yum install docker
Run Code Online (Sandbox Code Playgroud)
请参阅在 Red Hat Enterprise Linux 上安装。
| 归档时间: |
|
| 查看次数: |
30864 次 |
| 最近记录: |