How to tell Docker to store and run containers on an external drive
Solution 1:
Several things helped me get this working. First, I was mounting the external filesystem in a home directory, which may have been causing some permissions issues. So I remounted the filesystem under /mnt
and updated permissions and ownership as follows:
# chown -R root:root /mnt/external-drive/docker-base
# chmod 701 /mnt/external-drive/docker-base
Then I created the /etc/docker/daemon.json
file with these contents:
{
"graph": "/mnt/external-drive/docker-base"
}
I restarted the docker service and all seems to be well. Doing a docker build
and the external drive is receiving all the contents.