开发者问题收集

在其他分区上安装 docker 时出错

2019-09-14
579

大约三周前,我在 28G(sdb5)分区上安装了 Kubuntu 18,但安装 docker 后,似乎这个空间不足以容纳我的根分区 我发现 /var/lib/docker/ 占用了 11.1 GiB。

我发现了使用 sdb7 分区来安装 docker 的决定,但现在已不再使用。 因此,在我将 /sdb7 格式化为 ext4 并在 /etc/fstab 中使用 /sdb7 并重新启动操作系统后,我运行:

cd /var/lib
sudo rsync -av docker /mnt/_work_sdb7
sudo mv docker docker.old
sudo ln -s /mnt/_work_sdb7/docker

接下来:

$ docker-compose up -d --build
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

我找到了一种修复此类错误的方法:

sudo  usermod -aG docker $USER
sudo  newgrp - docker

但这没有帮助。下一步:

缺少某些配置/权限?

# docker-compose --version
docker-compose version 1.17.1, build unknown
# docker --version
Docker version 19.03.2, build 6a30dfc

已修改:

我运行命令并在控制台中看到消息:

$ sudo dockerd --data-root=/mnt/_work_sdb7
INFO[2019-09-14T14:56:26.394402307+03:00] Starting up                                  
INFO[2019-09-14T14:56:26.395196810+03:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf 
INFO[2019-09-14T14:56:26.444127000+03:00] parsed scheme: "unix"                         module=grpc
INFO[2019-09-14T14:56:26.444152461+03:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-09-14T14:56:26.444179994+03:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] }  module=grpc
INFO[2019-09-14T14:56:26.444193376+03:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-09-14T14:56:26.444651765+03:00] pickfirstBalancer: HandleSubConnStateChange: 0xc000143020, CONNECTING  module=grpc
INFO[2019-09-14T14:56:26.444710232+03:00] blockingPicker: the picked transport is not ready, loop back to repick  module=grpc
INFO[2019-09-14T14:56:26.463935589+03:00] pickfirstBalancer: HandleSubConnStateChange: 0xc000143020, READY  module=grpc
INFO[2019-09-14T14:56:26.503211493+03:00] parsed scheme: "unix"                         module=grpc
INFO[2019-09-14T14:56:26.503236499+03:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-09-14T14:56:26.503253831+03:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] }  module=grpc
INFO[2019-09-14T14:56:26.503264403+03:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-09-14T14:56:26.503334016+03:00] pickfirstBalancer: HandleSubConnStateChange: 0xc000143420, CONNECTING  module=grpc
INFO[2019-09-14T14:56:26.503354596+03:00] blockingPicker: the picked transport is not ready, loop back to repick  module=grpc
INFO[2019-09-14T14:56:26.503629147+03:00] pickfirstBalancer: HandleSubConnStateChange: 0xc000143420, READY  module=grpc
WARN[2019-09-14T14:56:26.584401464+03:00] Your kernel does not support swap memory limit 
WARN[2019-09-14T14:56:26.584423249+03:00] Your kernel does not support cgroup rt period 
WARN[2019-09-14T14:56:26.584431948+03:00] Your kernel does not support cgroup rt runtime 
INFO[2019-09-14T14:56:26.584832727+03:00] Loading containers: start.                   
INFO[2019-09-14T14:56:26.861388365+03:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[2019-09-14T14:56:27.120567034+03:00] Loading containers: done.                    
INFO[2019-09-14T14:56:27.294102345+03:00] Docker daemon                                 commit=6a30dfc graphdriver(s)=overlay2 version=19.03.2
INFO[2019-09-14T14:56:27.294224407+03:00] Daemon has completed initialization          
INFO[2019-09-14T14:56:27.366695106+03:00] API listen on /var/run/docker.sock              

上述命令未完成但正在运行:

我在其他选项卡中打开控制台并运行:

$ sudo  usermod -aG docker $USER
$ sudo  newgrp - docker
# cd /mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker
# sudo systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
# sudo systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-09-14 15:00:34 EEST; 8s ago
     Docs: https://docs.docker.com
  Process: 14694 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 14694 (code=exited, status=1/FAILURE)

Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Stopped Docker Application Container Engine.
Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.service: Start request repeated too quickly.
Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Failed to start Docker Application Container Engine.
# journalctl -xe
-- Automatic restarting of the unit docker.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.service has finished shutting down.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Closed Docker Socket for the API.
-- Subject: Unit docker.socket has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.socket has finished shutting down.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.socket has begun shutting down.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.socket has begun starting up.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.socket has finished starting up.
-- 
-- The start-up result is RESULT.
Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.service: Start request repeated too quickly.
Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 14 15:00:34 serge-at-hoe systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.service has failed.
-- 
-- The result is RESULT.
Sep 14 15:00:34 serge-at-hoe systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
Sep 14 15:00:42 serge-at-hoe systemd[1]: Started Run anacron jobs.
-- Subject: Unit anacron.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit anacron.service has finished starting up.
-- 
-- The start-up result is RESULT.
Sep 14 15:00:42 serge-at-hoe anacron[14760]: Anacron 2.3 started on 2019-09-14
Sep 14 15:00:42 serge-at-hoe anacron[14760]: Normal exit (0 jobs run)

出了什么问题?

已修改 2: 我找不到现有文件,因此我创建了新文件 /etc/docker/daemon.json 内容为:

{
  "data-root": "/mnt/_work_sdb7/docker" ,
  "storage-driver": "overlay2"
}


/etc/docker# ls -la
total 24
drwxr-xr-x   2 root root  4096 вер 14 16:52 .
drwxr-xr-x 150 root root 12288 вер 14 16:05 ..
-rwxrwxrwx   1 root root    81 вер 14 16:52 daemon.json
-rw-------   1 root root   244 вер  6 18:12 key.json

在我的 /etc/fstab 中:

/dev/sdb7 /mnt/_work_sdb7  ext4 defaults 0 0  

并重新启动操作系统。 之后,我在 docker 项目中运行:

$ sudo systemctl enable docker
[sudo] password for serge: 
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
serge@serge-at-hoe:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker$ sudo systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
serge@serge-at-hoe:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-09-14 16:54:09 EEST; 2s ago
     Docs: https://docs.docker.com
  Process: 5199 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 5199 (code=exited, status=1/FAILURE)

вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Service hold-off time over, scheduling restart.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
вер 14 16:54:09 serge-at-hoe systemd[1]: Stopped Docker Application Container Engine.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Start request repeated too quickly.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Failed with result 'exit-code'.
вер 14 16:54:09 serge-at-hoe systemd[1]: Failed to start Docker Application Container Engine.
serge@serge-at-hoe:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker$ journalctl -xe
-- 
-- Automatic restarting of the unit docker.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
вер 14 16:54:09 serge-at-hoe systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.service has finished shutting down.
вер 14 16:54:09 serge-at-hoe systemd[1]: Closed Docker Socket for the API.
-- Subject: Unit docker.socket has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.socket has finished shutting down.
вер 14 16:54:09 serge-at-hoe systemd[1]: Stopping Docker Socket for the API.
-- Subject: Unit docker.socket has begun shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support                                                                                                                                                                                                    
--                                                                                                                                                                                                                                           
-- Unit docker.socket has begun shutting down.                                                                                                                                                                                               
вер 14 16:54:09 serge-at-hoe systemd[1]: Starting Docker Socket for the API.                                                                                                                                                                 
-- Subject: Unit docker.socket has begun start-up                                                                                                                                                                                            
-- Defined-By: systemd                                                                                                                                                                                                                       
-- Support: http://www.ubuntu.com/support                                                                                                                                                                                                    
--                                                                                                                                                                                                                                           
-- Unit docker.socket has begun starting up.                                                                                                                                                                                                 
вер 14 16:54:09 serge-at-hoe systemd[1]: Listening on Docker Socket for the API.                                                                                                                                                             
-- Subject: Unit docker.socket has finished start-up                                                                                                                                                                                         
-- Defined-By: systemd                                                                                                                                                                                                                       
-- Support: http://www.ubuntu.com/support                                                                                                                                                                                                    
--                                                                                                                                                                                                                                           
-- Unit docker.socket has finished starting up.                                                                                                                                                                                              
--                                                                                                                                                                                                                                           
-- The start-up result is RESULT.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Start request repeated too quickly.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Failed with result 'exit-code'.
вер 14 16:54:09 serge-at-hoe systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit docker.service has failed.
-- 
-- The result is RESULT.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
вер 14 16:54:10 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=01:00:5e:00:00:01:c8:e7:f0:6e:fc:29:08:00 SRC=100.103.0.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=40300 PROTO=2 
вер 14 16:54:10 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=213.109.129.134 DST=213.109.234.130 LEN=44 TOS=0x00 PREC=0x00 TTL=250 ID=15541 DF PROTO=TCP SPT=35673 DPT=23 WINDOW=14600 R
вер 14 16:54:11 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=36.63.165.72 DST=213.109.234.130 LEN=52 TOS=0x00 PREC=0x00 TTL=115 ID=901 DF PROTO=TCP SPT=44000 DPT=1433 WINDOW=8192 RES=0
вер 14 16:54:12 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=01:00:5e:00:00:01:c8:e7:f0:6e:fc:29:08:00 SRC=100.103.0.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=48963 PROTO=2 
вер 14 16:54:23 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=159.224.38.32 DST=213.109.234.130 LEN=60 TOS=0x00 PREC=0x00 TTL=56 ID=26239 DF PROTO=TCP SPT=34959 DPT=6881 WINDOW=7300 RES
вер 14 16:54:23 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=185.222.211.54 DST=213.109.234.130 LEN=40 TOS=0x00 PREC=0x00 TTL=251 ID=1768 PROTO=TCP SPT=41109 DPT=8321 WINDOW=1024 RES=0
вер 14 16:54:23 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=87.122.153.155 DST=213.109.234.130 LEN=60 TOS=0x00 PREC=0x00 TTL=57 ID=2867 DF PROTO=TCP SPT=47437 DPT=6881 WINDOW=7300 RES
вер 14 16:54:24 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=159.224.38.32 DST=213.109.234.130 LEN=60 TOS=0x00 PREC=0x00 TTL=56 ID=26240 DF PROTO=TCP SPT=34959 DPT=6881 WINDOW=7300 RES
вер 14 16:54:24 serge-at-hoe kernel: [UFW BLOCK] IN=enp4s0 OUT= MAC=44:8a:5b:ee:2a:dd:c8:e7:f0:6e:fc:29:08:00 SRC=87.122.153.155 DST=213.109.234.130 LEN=60 TOS=0x00 PREC=0x00 TTL=57 ID=2868 DF PROTO=TCP SPT=47437 DPT=6881 WINDOW=7300 RES
lines 2823-2877/2877 (END)

我看到错误:

вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Start request repeated too quickly.
вер 14 16:54:09 serge-at-hoe systemd[1]: docker.service: Failed with result 'exit-code'.
вер 14 16:54:09 serge-at-hoe systemd[1]: Failed to start Docker Application Container Engine.

修改 3: 我发现 /etc/systemd/system.conf 中的所有参数都已注释 我取消注释或添加一些参数并增加其值,然后重新启动操作系统。我这样做过几次,至少我有:

DefaultStartLimitIntervalSec=350s
DefaultStartLimitBurst=260
StartLimitInterval=350s
StartLimitBurst=260
StartLimitIntervalSec=260

虽然所有其他参数都已注释,但无论如何我都看到错误:

вер 14 18:05:44 serge-at-hoe systemd[1]: docker.service: Start request repeated too quickly.
вер 14 18:05:44 serge-at-hoe systemd[1]: docker.service: Failed with result 'exit-code'.
вер 14 18:05:44 serge-at-hoe systemd[1]: Failed to start Docker Application Container Engine.

哪些值必须具有这些(或其他)值?

修改 # 4: 我尝试在 /etc/systemd/system.conf 中将一些值更改为零,因为我在 Google 上搜索了这种可能的决定:

DefaultStartLimitIntervalSec=0
DefaultStartLimitBurst=260
StartLimitInterval=350
StartLimitBurst=260
StartLimitIntervalSec=0

但重新启动操作系统时我无法登录系统,屏幕上出现很多闪烁消息。 我修改了文件,所有都是 0:

DefaultStartLimitIntervalSec=0
DefaultStartLimitBurst=0
StartLimitInterval=0
StartLimitBurst=0
StartLimitIntervalSec=0

我重新加载,但运行 docker 时仍然出现“启动请求重复太快”错误:

$ sudo  usermod -aG docker $USER
#:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker$ sudo  newgrp - docker
#:/root# cd /mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker
#:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker# sudo systemctl start docker   
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
#:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker# sudo systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
#:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker# sudo systemctl start docker   
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
#:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-09-16 14:30:07 EEST; 298ms ago
     Docs: https://docs.docker.com
  Process: 5183 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 5183 (code=exited, status=1/FAILURE)

Sep 16 14:30:07 s systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Sep 16 14:30:07 s systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Sep 16 14:30:07 s systemd[1]: Stopped Docker Application Container Engine.
Sep 16 14:30:07 s systemd[1]: docker.service: Start request repeated too quickly.
Sep 16 14:30:07 s systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 16 14:30:07 s systemd[1]: Failed to start Docker Application Container Engine.
#:/mnt/_work_sdb8/wwwroot/lar/DockerApps/votes_docker# journalctl -xe
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snapd.service has finished shutting down.
Sep 16 14:30:15 s systemd[1]: Starting Snappy daemon...
-- Subject: Unit snapd.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snapd.service has begun starting up.
Sep 16 14:30:15 s snapd[6435]: AppArmor status: apparmor is enabled and all features are available
Sep 16 14:30:15 s snapd[6435]: cannot run daemon: assert storage root unexpectedly world-writable: /var/lib/snapd/assertions/asserts-v0
Sep 16 14:30:15 s systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILURE
Sep 16 14:30:15 s systemd[1]: snapd.service: Failed with result 'exit-code'.                                                                                                                                                      
Sep 16 14:30:15 s systemd[1]: Failed to start Snappy daemon.                                                                                                                                                                      
-- Subject: Unit snapd.service has failed                                                                                                                                                                                                    
-- Defined-By: systemd                                                                                                                                                                                                                       
-- Support: http://www.ubuntu.com/support                                                                                                                                                                                                    
--                                                                                                                                                                                                                                           
-- Unit snapd.service has failed.                                                                                                                                                                                                            
--                                                                                                                                                                                                                                           
-- The result is RESULT.                                                                                                                                                                                                                     
Sep 16 14:30:15 s systemd[1]: snapd.service: Triggering OnFailure= dependencies.                                                                                                                                                  
Sep 16 14:30:15 s systemd[1]: snapd.service: Service hold-off time over, scheduling restart.                                                                                                                                      
Sep 16 14:30:15 s systemd[1]: snapd.service: Scheduled restart job, restart counter is at 25663.                                                                                                                                  
-- Subject: Automatic restarting of a unit has been scheduled                                                                                                                                                                                
-- Defined-By: systemd                                                                                                                                                                                                                       
-- Support: http://www.ubuntu.com/support                                                                                                                                                                                                    
--                                                                                                                                                                                                                                           
-- Automatic restarting of the unit snapd.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Sep 16 14:30:15 s systemd[1]: Stopped Snappy daemon.
-- Subject: Unit snapd.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snapd.service has finished shutting down.
Sep 16 14:30:15 s systemd[1]: Starting Snappy daemon...
-- Subject: Unit snapd.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snapd.service has begun starting up.
Sep 16 14:30:15 s snapd[6467]: AppArmor status: apparmor is enabled and all features are available
Sep 16 14:30:15 s snapd[6467]: cannot run daemon: assert storage root unexpectedly world-writable: /var/lib/snapd/assertions/asserts-v0
Sep 16 14:30:15 s systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILURE
Sep 16 14:30:15 s systemd[1]: snapd.service: Failed with result 'exit-code'.
Sep 16 14:30:15 s systemd[1]: Failed to start Snappy daemon.
-- Subject: Unit snapd.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snapd.service has failed.
-- 
-- The result is RESULT.
Sep 16 14:30:15 s systemd[1]: snapd.service: Triggering OnFailure= dependencies.

我不确定 /etc/systemd/system.conf 中的有效选项是否是其他问题?

2个回答

您输入的是:

sudo systemctl start docker
sudo systemctl enable docker

吗?

Misieq
2019-09-14

您尝试在另一个分区上安装 docker 的方式不正确。

  • 您需要一个分区(在您的情况下为 sdb7 )。假设它安装在 /mnt/sdb7

  • Docker 默认将其所有数据(容器、图像等)存储在 /var/lib/docker 中,您需要使用 docker 的 data-root 选项将其更改为 /mnt/sdb7/docker 之类的内容。

启动 docker deamon 时使用 --data-root 选项。

dockerd --data-root=/mnt/sdb7/docker

希望这会有所帮助。

更新:

dockerd 命令将在前台运行。

您需要为使用 systemctl 启动/停止的 docker.service 永久设置 --data-root 选项。

要永久设置该选项,请参考

您需要在 /etc/docker/daemon.json 文件中添加此行 "data-root": "/mnt/docker-data"

更新-2:

docker.socket:失败,结果为“service-start-limit-hit” 意味着 docker.service 似乎失败并重启得太快。 这里 对此进行了解释。

您需要使用 systemctl edit docker.service 编辑 docker 的 systemd 文件,如 这里 所述,并调整 StartLimitIntervalSec=StartLimitBurst= 的值,如 这里 所述,以便 docker.service 不会很快失败。

更新 3:

编辑 /etc/systemd/system.conf 文件很危险,它可能会导致您的 VM 出现严重问题。我建议使用 systemctl edit docker.service 进行更改。

docker.service systemd 文件内容应类似于 。 另请参阅

mchawre
2019-09-14