Docker – change default installation folder on Ubuntu

Images and containers can be hard drive space killers. So it’s a good idea to use a separated HD for docker. So, to change docker folder you must edit the file that starts docker service. On Ubuntu this file is located on /lib/systemd/system/docker.service You have to edit the line starting with ExecStart, adding -g flag with path of the target folder.
ExecStart=/usr/bin/dockerd -g /docker -H unix://
In this case docker will use /docker folder, that is a separated ext4 partition from a secondary HD.
UUID=162fa297-c10f-4b23-b839-a7d915ea4979 /docker ext4 defaults 0 2

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *