https://github.com/lhns/docker-cleanimage
A tool for cleaning up temp and cache directories to make docker images smaller
https://github.com/lhns/docker-cleanimage
build clean cleanimage docker image smaller
Last synced: over 1 year ago
JSON representation
A tool for cleaning up temp and cache directories to make docker images smaller
- Host: GitHub
- URL: https://github.com/lhns/docker-cleanimage
- Owner: lhns
- Created: 2019-10-24T14:05:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-26T16:28:21.000Z (almost 3 years ago)
- Last Synced: 2025-02-28T11:12:41.769Z (over 1 year ago)
- Topics: build, clean, cleanimage, docker, image, smaller
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-cleanimage
### A tool for cleaning up temp and cache directories to make docker images smaller
Installation procedures can produce a lot of logs and other cached files. This script attemts to clean up these files to make docker images a lot smaller.
## Usage in Dockerfile
### Download and install
```Dockerfile
ENV CLEANIMAGE_VERSION 2.0
ENV CLEANIMAGE_URL https://raw.githubusercontent.com/LolHens/docker-cleanimage/$CLEANIMAGE_VERSION/cleanimage
ADD ["$CLEANIMAGE_URL", "/usr/local/bin/"]
RUN chmod +x "/usr/local/bin/cleanimage"
```
### Execute after each layer where necessary
```Dockerfile
RUN apt-get install -y \
python3 \
&& cleanimage
```
## Supported Applications
- apt
- yum
- apk
- pip
## Commands
- apt-get -y --purge autoremove
- apt-get -y clean
- yum clean all
## Directories
- /tmp/*
- /var/cache/apk/*
- /var/tmp/*
- /var/lib/apt/lists/*
- /var/log/alternatives.log
- /var/log/apt/
- /var/log/bootstrap.log
- /var/log/btmp
- /var/log/dpkg.log
- /var/log/faillog
- /var/log/fsck/
- /var/log/lastlog
- /var/log/wtmp
- ~/.cache/pip
- Files in /var/cache/