4

虽然我只是按照主站点上的说明设法在 Ubuntu 19.10 上运行无根 docker 容器,但它只持续了一天。

https://docs.docker.com/engine/security/rootless/

重新启动机器后,docker daemon 再也没有工作过

systemctl --user status docker
● docker.service - Docker Application Container Engine (Rootless)
   Loaded: loaded (/home/ice/.config/systemd/user/docker.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2020-03-02 11:29:40 GMT; 2h 28min ago
     Docs: https://docs.docker.com
  Process: 1389 ExecStart=/home/ice/bin/dockerd-rootless.sh --experimental --storage-driver=overlay2 (code=exited, status=1/FAILURE)
 Main PID: 1389 (code=exited, status=1/FAILURE)

Mar 02 11:29:40 fractal systemd[8403]: docker.service: Service RestartSec=10s expired, scheduling restart.
Mar 02 11:29:40 fractal systemd[8403]: docker.service: Scheduled restart job, restart counter is at 3.
Mar 02 11:29:40 fractal systemd[8403]: Stopped Docker Application Container Engine (Rootless).
Mar 02 11:29:40 fractal systemd[8403]: docker.service: Start request repeated too quickly.
Mar 02 11:29:40 fractal systemd[8403]: docker.service: Failed with result 'exit-code'.
Mar 02 11:29:40 fractal systemd[8403]: Failed to start Docker Application Container Engine (Rootless).

即使直接启动,它也会显示为失败:

INFO[2020-03-02T11:44:18.153611017Z] containerd successfully booted in 0.004537s  
INFO[2020-03-02T11:44:18.159997216Z] parsed scheme: "unix"                         module=grpc
INFO[2020-03-02T11:44:18.160074256Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-03-02T11:44:18.160120957Z] ccResolverWrapper: sending update to cc: {[{unix:///run/user/1000/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-03-02T11:44:18.160150557Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-03-02T11:44:18.161936535Z] parsed scheme: "unix"                         module=grpc
INFO[2020-03-02T11:44:18.161964255Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-03-02T11:44:18.161985036Z] ccResolverWrapper: sending update to cc: {[{unix:///run/user/1000/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-03-02T11:44:18.161998776Z] ClientConn switching balancer to "pick_first"  module=grpc
ERRO[2020-03-02T11:44:18.164125566Z] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay2
ERRO[2020-03-02T11:44:18.164168586Z] [graphdriver] prior storage driver overlay2 failed: driver not supported 
INFO[2020-03-02T11:44:18.164831159Z] stopping healthcheck following graceful shutdown  module=libcontainerd
INFO[2020-03-02T11:44:18.164842919Z] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
failed to start daemon: error initializing graphdriver: driver not supported
[rootlesskit:child ] error: command [/home/ice/bin/dockerd-rootless.sh --experimental] exited: exit status 1
[rootlesskit:parent] error: child exited: exit status 1

新内核

$ uname -a
Linux fractal 5.3.0-40-generic #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.10
DISTRIB_CODENAME=eoan
DISTRIB_DESCRIPTION="Ubuntu 19.10"

$ docker version
Client: Docker Engine - Community
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.16
 Git commit:        369ce74a3c
 Built:             Thu Feb 13 01:24:49 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?


即使运行配置检查,也可以

- Storage Drivers:
  - "aufs":
    - CONFIG_AUFS_FS: enabled (as module)
  - "btrfs":
    - CONFIG_BTRFS_FS: enabled (as module)
    - CONFIG_BTRFS_FS_POSIX_ACL: enabled
  - "devicemapper":
    - CONFIG_BLK_DEV_DM: enabled
    - CONFIG_DM_THIN_PROVISIONING: enabled (as module)
  - "overlay":
    - CONFIG_OVERLAY_FS: enabled (as module)
  - "zfs":
    - /dev/zfs: present
    - zfs command: missing
    - zpool command: missing
4

1 回答 1

0

看来我已经设法解决了我自己的问题。

sudo groupadd docker
sudo usermod -aG docker $USER

systemctl --user restart docker.service

这些文档非常有用 -

https://docs.docker.com/install/linux/linux-postinstall/

docker info
Client:
 Debug Mode: false

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 9
 Server Version: 19.03.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
 Logging Driver: json-file
 Cgroup Driver: none
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 35bd7a5f69c13e1563af8a93431411cd9ecf5021
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
  rootless
 Kernel Version: 5.3.0-40-generic
 Operating System: Ubuntu 19.10
 OSType: linux
 Architecture: x86_64
 CPUs: 24
 Total Memory: 62.82GiB
 Name: fractal
 Docker Root Dir: /home/ice/.local/share/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
docker version
Client: Docker Engine - Community
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.16
 Git commit:        369ce74a3c
 Built:             Thu Feb 13 01:24:49 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.16
  Git commit:       369ce74a3c
  Built:            Thu Feb 13 01:32:22 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.12
  GitCommit:        35bd7a5f69c13e1563af8a93431411cd9ecf5021
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
于 2020-03-02T15:49:04.890 回答