Happen to run into disk space issue primarily caused due to /var/lib/docker/tmp eating up lots of space

OS:

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
$ docker --version
Docker version 19.03.2, build 6a30dfc

The /var/lib/docker/tmp is using up almost all the disk space when we do fresh docker-compose build on a node as part of nightly CI/CD build. I see lot of docker-builderxxxx under /var/lib/docker/tmp, is there a way where we can avoid this other than having a cron job to clean up /var/lib/docker/tmp folder on a regular basis?

May I suggest to try docker-compose build --force-rm --no-cache --pull (see https://docs.docker.com/compose/reference/build/ for explanation of the options)
The documentation does not indicate that those build options can be used within a docker-compose.yml file directly.

You will still need a cronjob, that regularily cleans up docker’s leftovers: docker system prune -a

Thanks Meyay. For some reason, i didn’t get any email for your reply. Will try and update.

Hi Meyay,
Unfortunately, the command docker-compose build --force-rm --no-cache didn’t help. We do run the docker system prune -a in a cron job but this doesn’t free up the /var/lib/docker/tmp/*, as you know, it only removed the unused volumes, networks and images.

Regards,
Vinod