cgswong/min-jessie
A minimal Debian GNU/Linux 8 (Jessie) Docker image, currently ~80 MB.
1.7K
A lot of the publicly available Docker base images and derivatives are pretty large for being light-weight, minimal images, having unneeded applications installed and taking up space. My goal here is to create an absolutely minimal base Docker image, based on Debian. To accomplish this I also use the docker-squash tool to free more space in the container before committing and checking in the image here. While BusyBox is a great alternative, I prefer a Debian base given it's wide user base, supportability and familiarity. Though I'll try my hand at BusyBox as well.
If you just want to use this image, pull
it and configure what you want:
docker pull cgswong/min-jessie
To use this image in your own project, use this FROM
line in your Dockerfile:
FROM cgswong/min-jessie:latest
Below are the steps I've taken to build this image. Note that in the interest of brievity I've not included the steps I've used to remove all the unwanted packages.
docker pull debian:jessie
docker images |grep jessie
, and run the container, docker run -it debian:jessie /bin/bash
Notice how small it is to start with.
# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
debian jessie 0e30e84e9513 2 weeks ago 122.8 MB
docker run -it 0e30e84e9513 /bin/bash
apt-get -y update && apt-get -y dist-upgrade
apt-get -y clean && apt-get -y autoclean && apt-get -y autoremove
cp -R /usr/share/locale/en\@* /tmp/ && rm -rf /usr/share/locale/* && mv /tmp/en\@* /usr/share/locale/
rm -rf /var/cache/debconf/*-old && rm -rf /var/lib/apt/lists/* && rm -rf /usr/share/doc/*
echo "`cat /etc/issue.net` Docker Image - cgswong/min-jessie - `date +'%Y/%m/%d'`" > /etc/motd
exit
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
042b883dc723 debian:jessie "/bin/bash" 3 minutes ago Exited (0) 8 seconds ago clever_fermi
# docker commit 042b883dc723
8bdbcea2f1c9516fa18e2be80cda4cdb331699c7468f59ab25a5c28e45716f09
# docker save 8bdbcea2f1c9516fa18e2be80cda4cdb331699c7468f59ab25a5c28e45716f09 | docker-squash -from root -t cgswong/min-jessie | docker load
# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
cgswong/jessie latest 7086d9406a02 56 seconds ago 83.08 MB
docker push cgswong/min-jessie
That's it! Feedback is welcome.
docker pull cgswong/min-jessie