blang / latex-docker

Docker-based latex compilation
MIT License
579 stars 146 forks source link

Why is ubuntu image smaller than debian? #1

Closed chairfield closed 8 years ago

chairfield commented 8 years ago

Hello,

I'm just getting into Docker and I thought I would be able to optimize the size of your LaTeX image, but to no avail; even though debian:latest is 2/3 the size of ubuntu:trusty (shaving off about 60 MB), the resulting debian:latest-based image is a whopping 300 MB larger! To satisfy my curiosity, would you happen to know why?

Base Image Virtual Size
ubuntu:trusty 3.664 GB
debian:latest 3.946 GB

Thanks for your work building this excellent repo.

blang commented 8 years ago

Hey, thank you for that interesting stat. It's a good idea to make this image a bit smaller.

Debians container is smaller because (among other things) less (more or less) essential dependencies are installed. That results in more dependencies pulled in by latex.

It's hard to tell the difference because repositories differ too.

I isolated the dependency difference between debian and ubuntu: Added only by ubuntu: https://gist.github.com/blang/5e9ad7d180d58b2c6712 Added only by debian: https://gist.github.com/blang/482d3920fd1fce3df2aa

The biggest difference (debian):

Package Size
texlive-lang-korean 40525052
texlive-lang-chinese 30793488
texlive-lang-japanese 8116072
libllvm3.5 7606578
cpp-4.9 5168834
libqtgui4 4189190
mupdf 3420730
libruby2.1 3276844
perl 2629342
perl-modules 2551450

You can remove packages like mupdf (pdf viewer, useless inside docker) or korean language packages. You might also save space by removing package file after installation.

chairfield commented 8 years ago

Thanks Benedikt. I was able to shave off some of the size of the debian image, but not enough to beat your ubuntu one. Further discussion would be in the realm of configuring LaTeX itself, and not your container.

For the record, I believe a serious opportunity to save space exists in the 1.5 GB of documentation texlive-full installs. I believe passing --no-install-recommends to apt-get during the install will exclude most/all of it, but I have not verified this. As I do not understand the additional ramifications of doing so, I'll close the issue without any PR.

Thanks for helping me experiment with Docker!