Configuring docker data directory

Dec 5, 2018

The data directory is where docker saves images, containers and some other stuffs. Sometimes its beneficial to configure the data directory outside of the default location. For example, when you want to use a bigger HDD partition. To configure the data directory, add the following lines in the docker daemon.json file:

{
    "data-root": "/external_ebs_volume/docker-data",
    "storage-driver": "overlay"
}

In linux, this file is found at /etc/docker/daemon.json