Docker default container location

Source: https://evodify.com/change-docker-storage-location/

Change Docker storage location: THE RIGHT WAY!

Luckily, the right way to change Docker storage location was not more complicated than the two non-working options I have described above.

You need to create a JSON file /etc/docker/daemon.json with the content pointing to the new storage location:

{
"data-root": "/mnt/newlocation"
}

You can read more about daemon.json in Docker docs.

Then, restart Docker or reboot the system:

sudo systemctl restart docker

If you get any error during the restart, pay attention to spaces in daemon.json. JSON files are sensitive to indentation and an extra or lacking space may cause an error. If Docker restarts fine, this new setting will make Docker place all new containers to the new location. However, old containers will stay in /etc/default/docker. I recommend removing all old containers: