![如何在 Ubuntu 20.04 上安装 Docker?](https://linux22.com/image/936445/%E5%A6%82%E4%BD%95%E5%9C%A8%20Ubuntu%2020.04%20%E4%B8%8A%E5%AE%89%E8%A3%85%20Docker%EF%BC%9F.png)
我花了一整天时间尝试安装 Docker,但我认为我的系统存在一些问题,导致无法正确安装和配置它。以下是我正在尝试安装的 Docker 的规格、我的 Ubuntu 系统以及我尝试过的方法...
眼镜:
- 描述:Ubuntu 20.04.2 LTS
- 代号:Focal
- Docker 版本 20.10.5,内部版本 55c4c88
我尝试过的方法:
我按照 Docker 提供的安装文档进行操作(https://docs.docker.com/engine/install/ubuntu/)。我尝试了列出的所有方法,并且总是能够找到我认为已安装 Docker 的位置,但它总是无法启动。运行时,journalctl -xe
我发现它出现错误“无法启动 Docker 应用程序容器引擎”。
当按照 Docker 列出的“使用存储库安装”方法运行时,sudo apt-get install docker-ce docker-ce-cli containerd.io
我收到下面提供的输出...
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2021-04-10 14:04:01 CDT; 6ms ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Process: 30954 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 30954 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of docker-ce-rootless-extras:
docker-ce-rootless-extras depends on docker-ce; however:
Package docker-ce is not configured yet.
dpkg: error processing package docker-ce-rootless-extras (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
docker-ce
docker-ce-rootless-extras
E: Sub-process /usr/bin/dpkg returned an error code (1)
我也尝试过运行sudo dockerd
,当我运行该命令时我收到此输出......
INFO[2021-04-10T14:07:34.379732477-05:00] Starting up
INFO[2021-04-10T14:07:34.380601807-05:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf
INFO[2021-04-10T14:07:34.381241252-05:00] parsed scheme: "unix" module=grpc
INFO[2021-04-10T14:07:34.381264907-05:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2021-04-10T14:07:34.381300038-05:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>} module=grpc
INFO[2021-04-10T14:07:34.381314640-05:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2021-04-10T14:07:34.382840191-05:00] parsed scheme: "unix" module=grpc
INFO[2021-04-10T14:07:34.382879930-05:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2021-04-10T14:07:34.382919283-05:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>} module=grpc
INFO[2021-04-10T14:07:34.382932330-05:00] ClientConn switching balancer to "pick_first" module=grpc
INFO[2021-04-10T14:07:34.389949119-05:00] [graphdriver] using prior storage driver: overlay2
WARN[2021-04-10T14:07:34.393356340-05:00] Your kernel does not support CPU realtime scheduler
WARN[2021-04-10T14:07:34.393368396-05:00] Your kernel does not support cgroup blkio weight
WARN[2021-04-10T14:07:34.393372980-05:00] Your kernel does not support cgroup blkio weight_device
INFO[2021-04-10T14:07:34.393489826-05:00] Loading containers: start.
WARN[2021-04-10T14:07:34.394967395-05:00] Running modprobe bridge br_netfilter failed with message: modprobe: WARNING: Module br_netfilter not found in directory /lib/modules/5.8.0-48-generic
, error: exit status 1
WARN[2021-04-10T14:07:34.398454303-05:00] Running iptables --wait -t nat -L -n failed with message: `modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.8.0-48-generic
iptables v1.8.4 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.`, error: exit status 3
INFO[2021-04-10T14:07:34.510702953-05:00] stopping event stream following graceful shutdown error="<nil>" module=libcontainerd namespace=moby
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.8.0-48-generic
iptables v1.8.4 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
(exit status 3)
格式不好,请见谅...如果有人有提示,我将不胜感激!如果有一些日志/代码有助于故障排除,请告诉我!
答案1
答案2
我能够通过重新安装操作系统(Ubuntu-Server)解决该问题。