How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

June 2, 2020

Change docker root directory by creating a systemd drop-in service file

Filed under: Linux — Tags: , , — admin @ 2:20 pm

 It is possible to change docker root directory by creating a systemd drop-in service file. This is useful when you want images and containers or docker generated files to be located in another partition or drive.

Create drop-in configuration file

  1. Create the systemd directory:
    sudo mkdir /etc/systemd/system/docker.service.d/
  2. Create the docker.service drop-in file:
    sudo nano /etc/systemd/system/docker.service.d/docker.root.conf
  3. Add the following configuration :
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -g /your/custom/docker/root -H fd://

Powered by WordPress