写点什么

Relocating the Docker root directory

作者:平凡人生
  • 2023-02-09
    河南
  • 本文字数:711 字

    阅读完需:约 2 分钟

Last Updated: 2022-11-04

If the file space in the Docker root directory is not adequate, you must relocate the directory.

Procedure

To relocate the Docker root directory, complete the following steps as root or a user with “sudo all” authority:

  1. Stop the Docker services:

sudo systemctl stop docker

sudo systemctl stop docker.socket

sudo systemctl stop containerd

  1. Create the necessary directory structure into which to move Docker root by running the following command. This directory structure must reside on a file system with at least 50 GB free disk space. Significantly more disk space might be required depending on your daily ingestion volumes and data retention policy.

sudo mkdir -p /new_dir_structure

  1. Move Docker root to the new directory structure:sudo mv /var/lib/docker /new_dir_structure

  2. Edit the file /etc/docker/daemon.json. If the file does not exist, create the file by running the following command:

sudo vim /etc/docker/daemon.json

Add the following information to this file:

{   "data-root": "/new_dir_structure/docker" }

  1. After the /etc/docker/daemon.json file is saved and closed, restart the Docker services:

sudo systemctl start docker

After you run the command, all Docker services through dependency management will restart.

Validate the new Docker root location:

docker info -f '{{ .DockerRootDir}}'

参考.

https://www.ibm.com/docs/en/z-logdata-analytics/5.1.0?topic=compose-relocating-docker-root-directory

用户头像

平凡人生

关注

一眼看透本质的人...... 2020-07-17 加入

花半秒钟就看透事物本质的人,和花一辈子都看不清事物本质的人,注定是截然不同的命运。

评论

发布
暂无评论
Relocating the Docker root directory_Docker_平凡人生_InfoQ写作社区