0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

RaspberryPi4にDockerをインストールしてdata-rootを変更する

Last updated at Posted at 2022-07-03

やりたいこと

RaspberryPi4にDockerをインストールします。デフォルトだと、/var/lib/dockerがdockerが使用するデータのルートディレクトリになってますが、これを適当な場所に変更します。

手順

1.dockerをインストールする

sudo apt install docker.io

2.dockerのデータルートを設定

以下のファイルを作成します。ファイルが存在しないので新規作成です。

/etc/docker/daemon.json
{
    "data-root": "/data/app/main/docker"
}

3.dockerを再起動します

sudo systemctl restart docker.service

ちゃんと/data/app/main/dockerにそれっぽいファイルができていることを確認します。

sudo ls -l /data/app/main/docker

4./var/lib/docker/は不要なので削除します

sudo rm -rf /var/lib/docker

5.piユーザのサブグループにdockerグループを追加します

sudo usermod -aG docker pi
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?