我使用mount /dev/vdb /mnt/data在/mnt/data上挂载硬盘
更改内部的默认docker文件夹:/etc/docker/daemon.json by
{
"graph": "/mnt/data/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.和
$ 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.发布于 2020-09-18 01:17:34
Docker在挂载您的非OS磁盘(mnt/data/docker)之前启动。您可以让docker等待挂载成功后再启动docker。
找到挂载,将Docker systemd服务文件编辑为require,等待挂载后再启动。
systemctl list-units --type==mount # Lists all the mounts.
systemctl status <example.mount> # Get details about mount. Find the one which matches your mount directory
sudo nano /lib/systemd/system/docker.service # Edit your systemd service file在"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>
...sudo systemctl daemon-reload
sudo systemctl restart docker.servicehttps://stackoverflow.com/questions/46587785
复制相似问题