During build steps of a docker image, I get errors on insufficient storage space. I've limited space on / but recently managed to mount a new storage device on /data. So how can I force docker daemon to use that directory to store underlying container and images data? or even move existing images and containers to there.
Add a comment |
1 Answer
You can do it by by modifying systemd's docker start up script. Open file /lib/systemd/system/docker.service with your favorite text editor and replace the following line where /data/path/docker is a location of your new chosen docker directory:
FROM: ExecStart=/usr/bin/docker daemon -H fd:// TO: ExecStart=/usr/bin/docker daemon -g /data/path/docker -H fd:// When ready stop docker service:
systemctl stop docker