Docker无法使用装载硬盘上的数据重新启动

Docker无法使用装载硬盘上的数据重新启动,docker,Docker,我使用mount/dev/vdb/mnt/data在/mnt/data上挂载硬盘驱动器 更改:/etc/docker/daemon.json中的默认docker文件夹 一切正常 但在计算机重新启动后: docker守护程序无法重新启动 我得到了这些错误: $ service docker start Job for docker.service failed because the control process exited with error code. See "systemctl st

我使用mount/dev/vdb/mnt/data在/mnt/data上挂载硬盘驱动器

更改:/etc/docker/daemon.json中的默认docker文件夹

一切正常

但在计算机重新启动后: docker守护程序无法重新启动

我得到了这些错误:

$ service docker start
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.


Docker在非OS磁盘mnt/data/Docker装入之前启动。您可以要求docker在启动docker之前等待成功装载

找到装载,编辑Docker systemd服务文件以满足要求,并等待装载后再开始

systemctl list units-type==挂载列出所有挂载。 systemctl状态获取有关装载的详细信息。查找与您的装载目录匹配的目录 sudo nano/lib/systemd/system/docker.service编辑您的systemd服务文件 在After和Requires行的末尾添加名称

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service <example.mount>
Wants=network-online.target
Requires=docker.socket <example.mount>
...


您是否将新的挂载添加到/etc/fstab@Henry你说得对,我只是在启动时添加了挂载过程。问题解决了。不知道为什么docker不想以其他方式重新启动。没有/etc/fstab条目,docker根本无法访问驱动器/数据,因此这是必须完成的一个强制性步骤
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Thu 2017-10-05 13:58:58 UTC; 45s ago
     Docs: https://docs.docker.com
  Process: 5896 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 5896 (code=exited, status=1/FAILURE)

Oct 05 13:58:58 mycomputer systemd[1]: Failed to start Docker Application Container Engine.
Oct 05 13:58:58 mycomputer systemd[1]: docker.service: Unit entered failed state.
Oct 05 13:58:58 mycomputer systemd[1]: docker.service: Failed with result 'exit-code'.
Oct 05 13:58:58 mycomputer systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Oct 05 13:58:58 mycomputer systemd[1]: Stopped Docker Application Container Engine.
Oct 05 13:58:58 mycomputer systemd[1]: docker.service: Start request repeated too quickly.
Oct 05 13:58:58 mycomputer systemd[1]: Failed to start Docker Application Container Engine.
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service <example.mount>
Wants=network-online.target
Requires=docker.socket <example.mount>
...

sudo systemctl daemon-reload
sudo systemctl restart docker.service