Debian Docker Image

From campisano.org
Jump to navigation Jump to search

You can start with a Cdebootstrap minimal debian and then

as root, create a root.tar file with

cd DEBIAN_*; tar -cf ../root.tar ./; cd ..

then, as a common user, create the follow Dockerfile:

FROM scratch
ADD root.tar /

RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
    && apt-get -q -y update \
    && apt-get -q -y install ca-certificates \
    && apt-get -q -y install netcat-traditional telnet iputils-ping curl \
    && apt-get -q clean \
    && rm -rf /var/lib/apt/lists/* /var/cache/apt/* /usr/share/man/*

RUN date --iso-8601=seconds >> /tmp/build.date
ENTRYPOINT []
CMD ["/bin/bash"]

and build the image with

docker build . -t debian:custom


References

https://github.com/jmtd/debian-docker/blob/master/build/Dockerfile https://wiki.debian.org/Cloud/CreateDockerImage https://joeyh.name/blog/entry/docker_run_debian/