#!/bin/sh # docker-apt-clean -- to keep Docker image size small # Copyright (C) 2017 Olaf Meeuwissen # # License: GPL-3.0+ # Running `apt-get clean` from within apt-get causes deadlock due to # the locking mechanism used by apt-get. This script has a similar # effect as running `apt-get clean` but circumvents the deadlock. DIR=/ CACHE=var/cache/apt/ eval $(apt-config shell DIR Dir) eval $(apt-config shell CACHE Dir::Cache) find $DIR$CACHE -type f -name '*.deb' -delete find $DIR$CACHE -type f -name '*.bin' -delete