Help us understand the problem. What is going on with this article?

Docker Root Dir を /var/lib/docker から /foo/bar/docker へ変更する方法

More than 1 year has passed since last update.

linuxの場合/etc/docker/daemon.jsonでパス(graph)を指定すると変更できる。


dockerdを停止して、設定ファイルを編集する。

$ sudo service docker stop
$ mkdir /foo/bar/docker
$ sudo vi /etc/docker/daemon.json

設定ファイルの詳細はこちらを参照のこと。今回はRoot Dirを変更したいだけなので下記の通り。daemon.jsonが存在しない場合は新しく作る。

/etc/docker/daemon.json
{
    "graph": "/foo/bar/docker"
}

設定を変更したらdockerdを再起動する前に/var/lib/dockerから新しいディレクトリへファイルをコピーする。rsyncを使うといいらしいけど詳しくはggってください。

コピーが終わったらdockerdを再起動して設定内容を確認。

$ sudo service docker start
$ docker info | grep 'Docker Root Dir'
Docker Root Dir: /foo/bar/docker
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away