Skip to content

About

A simple shell script to clean up GitLab Runner images, cache, and remove oldest Docker images.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Runner Cleanup

A simple shell script to clean up GitLab Runner images, cache, and remove oldest Docker images.

Features

What it does:

This script automates the process of:

  • Cleaning up unused Docker images in the GitLab Runner registry
  • Removing unnecessary cache files generated by GitLab Runner
  • Deleting oldest Docker images and only keep MAX_IMAGES latest

Run

Running the Script Manually

Run this script on your linux runner:

curl -sL "https://github.com/nh4ttruong/runner-cleanup/raw/main/run.sh" | bash

Automating with Cron

To automate the script, we'll add it to the cron daily schedule. This way, the script will run automatically every day, keeping your GitLab Runner instances and Docker environments tidy and efficient.

Here's how to add the script to cron:

  • Open the cron table for editing: crontab -e
  • Add the following line to the file:

For automatically, add it into crontab:

@hourly curl -sL "https://github.com/nh4ttruong/runner-cleanup/raw/main/run.sh" | bash

Related

Here are some related projects

GitLab Runner

About

A simple shell script to clean up GitLab Runner images, cache, and remove oldest Docker images.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages