HomeGuidesChangelog
GuidesDiscussionChangelogLog In

Free Up Docker Disk Space

Tips on how to safely clean up Docker disk space

After using Gigantum for a while you may notice that the disk space allocated to Docker may begin to fill. Every once in a while it will be necessary to perform some housekeeping to make sure there is enough disk space to keep building your projects.

Each Gigantum project has an associated Docker image, and as the count of Projects on disk increases, so too will Docker disk use rise.

Option 1: Raise Docker disk allocation limit

The first option is to simply raise the amount of space available to Docker images. For relatively recent computers, we would suggest no less than 64GB allocated toward Docker images. To change the allocation, select the Docker icon in the system tray. Click "Preferences" and then choose the "Disk" icon.

Example Docker configuration window on macOSExample Docker configuration window on macOS

Example Docker configuration window on macOS

Option 2: Delete unused local Gigantum Projects

If you have any old Gigantum projects that you no longer need (or have published to our Gigantum cloud), it can be a good idea to remove them off your local machine.

To delete a project off your local machine, first navigate to the project's page and then select the "Delete Project" option from the menu in the top right side of the screen.

Once you select this, you will need to re-type the name of the project in order to confirm deletion.

Option 3: Remove specific Gigantum Project images

If you run docker images to list the Docker images on your machine, you may notice several with a gmlb- prefix. This stands for "Gigantum-Managed LabBook" and indicates that it was built by the Gigantum client and managed by it. Generally, the gmlb- prefix is good for quickly locating all Gigantum project images.

You can search for Gigantum-managed Project images with the following command. You may then remove any large images by

# Search for all Gigantum-managed images
docker images | grep '^gmlb-'

# Delete any image
docker rmi <image-id>

Note, this will not delete the project on disk, only the docker image!

Option 4: Remove Old Gigantum Managed Images

The script below will remove any Gigantum managed image that is older than 2880 hours. This equates to 120 days, or about 4 months. You can change the threshold by changing this value. Any image older than the until value will be removed.

There are two commands because Gigantum images have been built with two different maintainer labels. Only very old images will have the [email protected] label, but it is included here for completeness and safe to run.

Note, this can remove ANY image, including the Gigantum Client Docker image. If this does occur, you'll just have to re-download the image, which should happen automatically when you start Gigantum Desktop, or can be done manually using gigantum install from the Gigantum CLI.

# Remove images older than 2880 hours, aka 120 days, aka about 4 months
docker image prune --filter 'until=2880h' --filter "label=maintainer=Gigantum <[email protected]>" -a -f

docker image prune --filter 'until=2880h' --filter "label=maintainer=Gigantum <[email protected]>" -a -f