Limited space disk for Jenkins

This message is extracted from a ticket originally emailed to support@gruntwork.io. Names and URLs have been removed where appropriate.

I’m currently trying to setup the CI using Jenkins. Unfortunately, when I
try to build a Docker image, there is not enough space on the instance
Jenkins is running on.

After small investigation, I found out that Docker build his images using
temporary files stored in the /var/lib/docker folder.

Even though the /jenkins folder has a 200GiB of available space, the root / is limited to 7.7GiB.

By removing all the Docker images and containers, I’ve managed to free ~40% of the space disk.

However, since our Docker images are big, this problem will occur the next
time I’ll try to build one and we won’t be able to run them.

Is there a way to increase the space disk for this instance?

Thank you for all the background details and your own investigations! As you suggested in your own ticket, I believe we can solve this by changing the path Docker uses for temporary storage while building images. To accomplish that, you can update the Docker Daemon’s configuration by modifying the data-root​ property. The Docker Daemon is the service that executes Docker and which sets all the global defaults that Docker uses when building images, running containers, or doing just about anything else. Per the Docker Daemon docs, here is the official explanation of the data-root property:

–data-root is the path where persisted data such as images, volumes, and cluster state are stored. The default value is /var/lib/docker. To avoid any conflict with other daemons, set this parameter separately for each daemon.

You can update this setting either by passing the --data-root​ option to the dockerd​ binary (the Docker Daemon binary) when it loads on your server, or by updating the Docker Daemon configuration file, which by default lives at /etc/docker/daemon.json​. In that file, look for the data-root​ property.

I’m not sure how you’ve configured Docker on your Jenkins box, so I can’t be more specific than that right now, but I think your best option is to update the /etc/docker/daemon.json​ file and then reboot the Docker daemon. If you run into any challenges getting this configured, please let me know and we’d be happy to provide additional support!