GenAIExamples icon indicating copy to clipboard operation
GenAIExamples copied to clipboard

Why containers use hundreds of MBs for Vim/Perl/OpenGL?

Open eero-t opened this issue 1 year ago • 7 comments

Many of the Dockerfiles install Vim and/or Mesa OpenGL/X packages:

$ git grep -l -B1 -e mesa-glx -e '\bvim\b'
AudioQnA/langchain/docker/Dockerfile
ChatQnA/deprecated/langchain/docker/Dockerfile
ChatQnA/docker/Dockerfile
CodeGen/deprecated/codegen/Dockerfile
CodeGen/docker/Dockerfile
CodeTrans/deprecated/langchain/docker/Dockerfile
CodeTrans/docker/Dockerfile
DocSum/deprecated/langchain/docker/Dockerfile
DocSum/docker/Dockerfile
Translation/langchain/docker/Dockerfile

Why?

They take lot of space in the containers; Mesa's LLVM dependency alone adds >100MB, Vim adds 40MB, and I suspect they're reason why full Perl gets installed:

$ docker images | grep chatqna
<MY_REGISTRY>/dgpu-enabling/opea-chatqna       latest      4b71cbea8ab6   36 minutes ago   727MB

$ docker run -it --rm --entrypoint /bin/sh opea/chatqna -c "du -ks /usr/*/*/* | sort -nr"
214284	/usr/local/lib/python3.11
114564	/usr/lib/x86_64-linux-gnu/libLLVM-15.so.1
40520	/usr/share/vim/vim90
30532	/usr/lib/x86_64-linux-gnu/libicudata.so.72.1
25936	/usr/lib/x86_64-linux-gnu/perl
25164	/usr/lib/x86_64-linux-gnu/dri
22736	/usr/lib/x86_64-linux-gnu/libz3.so.4
20732	/usr/share/perl/5.36.0
...

If containers really need text-editor, e.g. nano would be user-friendlier and much smaller (1MB) than vim.

eero-t avatar May 30 '24 14:05 eero-t