Hi, I was trying to package a project in docker and to start I did a fairly straightforward command: $ guix pack --format=docker elixir It generated an image quite a bit larger than I expected. -r--r--r-- 2 root root 461M Dec 31 1969 gfnqg760z22vr8kbvyzdzhs1hc5766c9-elixir-docker-pack.tar.gz After uncompressing, this is taking 1.5GB and is including quite a few unnecessary packages for a minimal image - see below for the top 30. $ du -s * |sort -g -r | head -n 30 155804 g3idjpqsp2p2d163qfzskxj4k58nrx7f-llvm-11.0.0 145164 m59c9hj9d4n65maimbpmx2xq56d2mvqs-mesa-20.2.4 111708 q233v022vziq8ry18y8q959k110vclvf-webkitgtk-2.32.1 110840 cgqj7xswlpvhzxwri3mcqfs1fhbgnka8-erlang-23.2.1 103940 qk5v5vzwfl066zch67nxlv4x7aspf0fx-samba-4.13.4 93972 cw8brvxkzp4kmdqldsv1wkvi2cv4kq4x-python-3.8.2 64620 8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2 56300 18hp7flyb3yid3yp49i6qcdq0sbi5l1n-guile-3.0.2 52748 nscar35x261xky08qih2ddxq1b105qwd-gtk+-3.24.24 41092 fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 39544 2wqjj3mkqdvsvksndr2hpjpi7qqwi7kr-icu4c-66.1 35848 fi1mdh30b5q6zvplvayn68lb575xcd1k-ghostscript-with-cups-9.52 34768 01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib 34188 wjmydimw608k61qxmsifkam11jwgpric-wxwidgets-3.0.5.1 24224 jv6v8p8jbjf6hpscgp3dgdfylrdhldi1-gdk-pixbuf+svg-2.40.0 18488 n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32 18464 57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32 16596 jsqxxnaj5p8a22mrsvl679gi7jl26z4j-glib-2.62.6 16400 aza259fsrb841zwb4rjzfzs2nrsf28f1-eudev-3.2.9 16060 9z185s19zp2p9yq8gdayxgibaphxfcps-cups-2.3.3 15604 4l2il4wcxjb443xwc2arwixpq28pbfvl-cups-minimal-2.3.3 14140 02z5vgdhgxw4gcjvhx51mvy1ax4lzxmp-fftwf-3.3.8 13912 zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2 13096 lv92cmzqjpb8mxygpqdvh0mkkkfi9vmz-libxcb-1.14 10876 n3pjsbpd51x6vqikfglmrdbijflammf6-gst-plugins-base-1.18.2 10588 sayvymkqjl328rsivzlp9r46337rvdmz-pulseaudio-14.0 10084 7y3lvk3xf4im8n44337mc6y0ccysvfia-font-dejavu-2.37 9888 hr1p9l1waam8lk2csdwbzaipf14h9n33-gstreamer-1.18.2 9576 a45p39mgqvfd8kjwibyr0q42k1mw7gmf-util-linux-2.35.1-lib 8812 z3vbqvpgcz7lag9qci074hjry4j3120i-shared-mime-info-1.15 I wouldn't expect to need llvm, mesa, webkit, samba, python, perl, gtk, cups, pulseaudio, etc, etc. in a production image. What would be the recommended way to minimize the derivation? Thanks, TJ
Hi ! You can use guix graph to see what depends on what, and find out why a specific dependency is needed: https://guix.gnu.org/manual/en/html_node/Invoking-guix-graph.html I just invoked: guix graph elixir > /tmp/toto.dot and by manually inspecting the dot file I can see that e.g. webkit is needed by wxWidgets, whether you need those or not is up to you. You can generate the visual graph with dot -T pdf < /tmp/toto.dot > /tmp/toto.pdf I'm looking at it right now, and I see that elixir depends on erlang and git, and that git is pulling perl with it. I doubt that's needed, so maybe you can create a new package "lean-elixir", and forego the dependency on git somehow ? If you cut a branch early in the DAG you may get huge returns on investment, size-wise. This may not be the best approach, maybe some wizards here will have better ideas. Cheers, Edouard. TJ writes: > Hi, > > I was trying to package a project in docker and to start I did a fairly > straightforward command: > > $ guix pack --format=docker elixir > > It generated an image quite a bit larger than I expected. > > -r--r--r-- 2 root root 461M Dec 31 1969 gfnqg760z22vr8kbvyzdzhs1hc5766c9-elixir-docker-pack.tar.gz > > After uncompressing, this is taking 1.5GB and is including quite a few > unnecessary packages for a minimal image - see below for the top 30. > > $ du -s * |sort -g -r | head -n 30 > 155804 g3idjpqsp2p2d163qfzskxj4k58nrx7f-llvm-11.0.0 > 145164 m59c9hj9d4n65maimbpmx2xq56d2mvqs-mesa-20.2.4 > 111708 q233v022vziq8ry18y8q959k110vclvf-webkitgtk-2.32.1 > 110840 cgqj7xswlpvhzxwri3mcqfs1fhbgnka8-erlang-23.2.1 > 103940 qk5v5vzwfl066zch67nxlv4x7aspf0fx-samba-4.13.4 > 93972 cw8brvxkzp4kmdqldsv1wkvi2cv4kq4x-python-3.8.2 > 64620 8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2 > 56300 18hp7flyb3yid3yp49i6qcdq0sbi5l1n-guile-3.0.2 > 52748 nscar35x261xky08qih2ddxq1b105qwd-gtk+-3.24.24 > 41092 fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 > 39544 2wqjj3mkqdvsvksndr2hpjpi7qqwi7kr-icu4c-66.1 > 35848 fi1mdh30b5q6zvplvayn68lb575xcd1k-ghostscript-with-cups-9.52 > 34768 01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib > 34188 wjmydimw608k61qxmsifkam11jwgpric-wxwidgets-3.0.5.1 > 24224 jv6v8p8jbjf6hpscgp3dgdfylrdhldi1-gdk-pixbuf+svg-2.40.0 > 18488 n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32 > 18464 57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32 > 16596 jsqxxnaj5p8a22mrsvl679gi7jl26z4j-glib-2.62.6 > 16400 aza259fsrb841zwb4rjzfzs2nrsf28f1-eudev-3.2.9 > 16060 9z185s19zp2p9yq8gdayxgibaphxfcps-cups-2.3.3 > 15604 4l2il4wcxjb443xwc2arwixpq28pbfvl-cups-minimal-2.3.3 > 14140 02z5vgdhgxw4gcjvhx51mvy1ax4lzxmp-fftwf-3.3.8 > 13912 zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2 > 13096 lv92cmzqjpb8mxygpqdvh0mkkkfi9vmz-libxcb-1.14 > 10876 n3pjsbpd51x6vqikfglmrdbijflammf6-gst-plugins-base-1.18.2 > 10588 sayvymkqjl328rsivzlp9r46337rvdmz-pulseaudio-14.0 > 10084 7y3lvk3xf4im8n44337mc6y0ccysvfia-font-dejavu-2.37 > 9888 hr1p9l1waam8lk2csdwbzaipf14h9n33-gstreamer-1.18.2 > 9576 a45p39mgqvfd8kjwibyr0q42k1mw7gmf-util-linux-2.35.1-lib > 8812 z3vbqvpgcz7lag9qci074hjry4j3120i-shared-mime-info-1.15 > > I wouldn't expect to need llvm, mesa, webkit, samba, python, perl, gtk, cups, pulseaudio, etc, etc. in a production image. > > What would be the recommended way to minimize the derivation? > > Thanks, > > TJ
[-- Attachment #1: Type: text/plain, Size: 3578 bytes --] I think it is expected. Docker images use only the kernel from the host OS when the host kernel is Linux (the host kernel, not the host OS). Wikipedia says: > Docker is a set of platform as a service (PaaS) products that use > OS-level virtualization to deliver software in packages called > containers.[6] Containers are isolated from one another and bundle > their own software, libraries and configuration files; they can > communicate with each other through well-defined channels.[7] TJ writes: > Hi, > > I was trying to package a project in docker and to start I did a fairly > straightforward command: > > $ guix pack --format=docker elixir > > It generated an image quite a bit larger than I expected. > > -r--r--r-- 2 root root 461M Dec 31 1969 gfnqg760z22vr8kbvyzdzhs1hc5766c9-elixir-docker-pack.tar.gz > > After uncompressing, this is taking 1.5GB and is including quite a few > unnecessary packages for a minimal image - see below for the top 30. > > $ du -s * |sort -g -r | head -n 30 > 155804 g3idjpqsp2p2d163qfzskxj4k58nrx7f-llvm-11.0.0 > 145164 m59c9hj9d4n65maimbpmx2xq56d2mvqs-mesa-20.2.4 > 111708 q233v022vziq8ry18y8q959k110vclvf-webkitgtk-2.32.1 > 110840 cgqj7xswlpvhzxwri3mcqfs1fhbgnka8-erlang-23.2.1 > 103940 qk5v5vzwfl066zch67nxlv4x7aspf0fx-samba-4.13.4 > 93972 cw8brvxkzp4kmdqldsv1wkvi2cv4kq4x-python-3.8.2 > 64620 8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2 > 56300 18hp7flyb3yid3yp49i6qcdq0sbi5l1n-guile-3.0.2 > 52748 nscar35x261xky08qih2ddxq1b105qwd-gtk+-3.24.24 > 41092 fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 > 39544 2wqjj3mkqdvsvksndr2hpjpi7qqwi7kr-icu4c-66.1 > 35848 fi1mdh30b5q6zvplvayn68lb575xcd1k-ghostscript-with-cups-9.52 > 34768 01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib > 34188 wjmydimw608k61qxmsifkam11jwgpric-wxwidgets-3.0.5.1 > 24224 jv6v8p8jbjf6hpscgp3dgdfylrdhldi1-gdk-pixbuf+svg-2.40.0 > 18488 n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32 > 18464 57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32 > 16596 jsqxxnaj5p8a22mrsvl679gi7jl26z4j-glib-2.62.6 > 16400 aza259fsrb841zwb4rjzfzs2nrsf28f1-eudev-3.2.9 > 16060 9z185s19zp2p9yq8gdayxgibaphxfcps-cups-2.3.3 > 15604 4l2il4wcxjb443xwc2arwixpq28pbfvl-cups-minimal-2.3.3 > 14140 02z5vgdhgxw4gcjvhx51mvy1ax4lzxmp-fftwf-3.3.8 > 13912 zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2 > 13096 lv92cmzqjpb8mxygpqdvh0mkkkfi9vmz-libxcb-1.14 > 10876 n3pjsbpd51x6vqikfglmrdbijflammf6-gst-plugins-base-1.18.2 > 10588 sayvymkqjl328rsivzlp9r46337rvdmz-pulseaudio-14.0 > 10084 7y3lvk3xf4im8n44337mc6y0ccysvfia-font-dejavu-2.37 > 9888 hr1p9l1waam8lk2csdwbzaipf14h9n33-gstreamer-1.18.2 > 9576 a45p39mgqvfd8kjwibyr0q42k1mw7gmf-util-linux-2.35.1-lib > 8812 z3vbqvpgcz7lag9qci074hjry4j3120i-shared-mime-info-1.15 > > I wouldn't expect to need llvm, mesa, webkit, samba, python, perl, gtk, cups, pulseaudio, etc, etc. in a production image. > > What would be the recommended way to minimize the derivation? > > Thanks, > > TJ -- Akib Azmain Turja This message is signed by me with my GnuPG key. It's fingerprint is: 7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5 See https://emailselfdefense.fsf.org/ to learn more and protect your emails and yourself from surveillance. -- Akib Azmain Turja This message is signed by me with my GnuPG key. It fingerprint is: 7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5 See https://emailselfdefense.fsf.org/ to learn more and protect your emails and yourself from surveillance. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --]
Thanks for the tip. I'm going to try to compile a minimal erlang.
Edouard Klein <edou@rdklein.fr> writes:
> Hi !
>
> You can use guix graph to see what depends on what, and find out why a
> specific dependency is needed:
>
> https://guix.gnu.org/manual/en/html_node/Invoking-guix-graph.html
>
> I just invoked:
> guix graph elixir > /tmp/toto.dot
>
> and by manually inspecting the dot file I can see that e.g. webkit is needed
> by wxWidgets, whether you need those or not is up to you.
>
> You can generate the visual graph with
> dot -T pdf < /tmp/toto.dot > /tmp/toto.pdf
>
> I'm looking at it right now, and I see that elixir depends on erlang and
> git, and that git is pulling perl with it.
>
> I doubt that's needed, so maybe you can create a new package
> "lean-elixir", and forego the dependency on git somehow ? If you cut a
> branch early in the DAG you may get huge returns on investment,
> size-wise.
>
>
> This may not be the best approach, maybe some wizards here will have
> better ideas.
>
> Cheers,
>
> Edouard.
> TJ writes:
>
>> Hi,
>>
>> I was trying to package a project in docker and to start I did a fairly
>> straightforward command:
>>
>> $ guix pack --format=docker elixir
>>
>> It generated an image quite a bit larger than I expected.
>>
>> -r--r--r-- 2 root root 461M Dec 31 1969 gfnqg760z22vr8kbvyzdzhs1hc5766c9-elixir-docker-pack.tar.gz
>>
>> After uncompressing, this is taking 1.5GB and is including quite a few
>> unnecessary packages for a minimal image - see below for the top 30.
>>
>> $ du -s * |sort -g -r | head -n 30
>> 155804 g3idjpqsp2p2d163qfzskxj4k58nrx7f-llvm-11.0.0
>> 145164 m59c9hj9d4n65maimbpmx2xq56d2mvqs-mesa-20.2.4
>> 111708 q233v022vziq8ry18y8q959k110vclvf-webkitgtk-2.32.1
>> 110840 cgqj7xswlpvhzxwri3mcqfs1fhbgnka8-erlang-23.2.1
>> 103940 qk5v5vzwfl066zch67nxlv4x7aspf0fx-samba-4.13.4
>> 93972 cw8brvxkzp4kmdqldsv1wkvi2cv4kq4x-python-3.8.2
>> 64620 8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2
>> 56300 18hp7flyb3yid3yp49i6qcdq0sbi5l1n-guile-3.0.2
>> 52748 nscar35x261xky08qih2ddxq1b105qwd-gtk+-3.24.24
>> 41092 fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31
>> 39544 2wqjj3mkqdvsvksndr2hpjpi7qqwi7kr-icu4c-66.1
>> 35848 fi1mdh30b5q6zvplvayn68lb575xcd1k-ghostscript-with-cups-9.52
>> 34768 01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib
>> 34188 wjmydimw608k61qxmsifkam11jwgpric-wxwidgets-3.0.5.1
>> 24224 jv6v8p8jbjf6hpscgp3dgdfylrdhldi1-gdk-pixbuf+svg-2.40.0
>> 18488 n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32
>> 18464 57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32
>> 16596 jsqxxnaj5p8a22mrsvl679gi7jl26z4j-glib-2.62.6
>> 16400 aza259fsrb841zwb4rjzfzs2nrsf28f1-eudev-3.2.9
>> 16060 9z185s19zp2p9yq8gdayxgibaphxfcps-cups-2.3.3
>> 15604 4l2il4wcxjb443xwc2arwixpq28pbfvl-cups-minimal-2.3.3
>> 14140 02z5vgdhgxw4gcjvhx51mvy1ax4lzxmp-fftwf-3.3.8
>> 13912 zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2
>> 13096 lv92cmzqjpb8mxygpqdvh0mkkkfi9vmz-libxcb-1.14
>> 10876 n3pjsbpd51x6vqikfglmrdbijflammf6-gst-plugins-base-1.18.2
>> 10588 sayvymkqjl328rsivzlp9r46337rvdmz-pulseaudio-14.0
>> 10084 7y3lvk3xf4im8n44337mc6y0ccysvfia-font-dejavu-2.37
>> 9888 hr1p9l1waam8lk2csdwbzaipf14h9n33-gstreamer-1.18.2
>> 9576 a45p39mgqvfd8kjwibyr0q42k1mw7gmf-util-linux-2.35.1-lib
>> 8812 z3vbqvpgcz7lag9qci074hjry4j3120i-shared-mime-info-1.15
>>
>> I wouldn't expect to need llvm, mesa, webkit, samba, python, perl, gtk, cups, pulseaudio, etc, etc. in a production image.
>>
>> What would be the recommended way to minimize the derivation?
>>
>> Thanks,
>>
>> TJ
Hi, On Fri, 16 Jul 2021 at 22:06, TJ <tj@sheer.tj> wrote: > I was trying to package a project in docker and to start I did a fairly > straightforward command: > > $ guix pack --format=docker elixir > > It generated an image quite a bit larger than I expected. > > -r--r--r-- 2 root root 461M Dec 31 1969 gfnqg760z22vr8kbvyzdzhs1hc5766c9-elixir-docker-pack.tar.gz I agree the size is an issue. > After uncompressing, this is taking 1.5GB and is including quite a few > unnecessary packages for a minimal image - see below for the top 30. > > $ du -s * |sort -g -r | head -n 30 > 155804 g3idjpqsp2p2d163qfzskxj4k58nrx7f-llvm-11.0.0 > 145164 m59c9hj9d4n65maimbpmx2xq56d2mvqs-mesa-20.2.4 > 111708 q233v022vziq8ry18y8q959k110vclvf-webkitgtk-2.32.1 > 110840 cgqj7xswlpvhzxwri3mcqfs1fhbgnka8-erlang-23.2.1 > 103940 qk5v5vzwfl066zch67nxlv4x7aspf0fx-samba-4.13.4 > 93972 cw8brvxkzp4kmdqldsv1wkvi2cv4kq4x-python-3.8.2 > 64620 8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2 > 56300 18hp7flyb3yid3yp49i6qcdq0sbi5l1n-guile-3.0.2 > 52748 nscar35x261xky08qih2ddxq1b105qwd-gtk+-3.24.24 > 41092 fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31 > 39544 2wqjj3mkqdvsvksndr2hpjpi7qqwi7kr-icu4c-66.1 > 35848 fi1mdh30b5q6zvplvayn68lb575xcd1k-ghostscript-with-cups-9.52 > 34768 01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib > 34188 wjmydimw608k61qxmsifkam11jwgpric-wxwidgets-3.0.5.1 > 24224 jv6v8p8jbjf6hpscgp3dgdfylrdhldi1-gdk-pixbuf+svg-2.40.0 > 18488 n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32 > 18464 57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32 > 16596 jsqxxnaj5p8a22mrsvl679gi7jl26z4j-glib-2.62.6 > 16400 aza259fsrb841zwb4rjzfzs2nrsf28f1-eudev-3.2.9 > 16060 9z185s19zp2p9yq8gdayxgibaphxfcps-cups-2.3.3 > 15604 4l2il4wcxjb443xwc2arwixpq28pbfvl-cups-minimal-2.3.3 > 14140 02z5vgdhgxw4gcjvhx51mvy1ax4lzxmp-fftwf-3.3.8 > 13912 zzkly5rbfvahwqgcs7crz0ilpi7x5g5p-ncurses-6.2 > 13096 lv92cmzqjpb8mxygpqdvh0mkkkfi9vmz-libxcb-1.14 > 10876 n3pjsbpd51x6vqikfglmrdbijflammf6-gst-plugins-base-1.18.2 > 10588 sayvymkqjl328rsivzlp9r46337rvdmz-pulseaudio-14.0 > 10084 7y3lvk3xf4im8n44337mc6y0ccysvfia-font-dejavu-2.37 > 9888 hr1p9l1waam8lk2csdwbzaipf14h9n33-gstreamer-1.18.2 > 9576 a45p39mgqvfd8kjwibyr0q42k1mw7gmf-util-linux-2.35.1-lib > 8812 z3vbqvpgcz7lag9qci074hjry4j3120i-shared-mime-info-1.15 > > I wouldn't expect to need llvm, mesa, webkit, samba, python, perl, > gtk, cups, pulseaudio, etc, etc. in a production image. You can use the option ’--path’ to find out why elixir depends on unexpected packages, for instance: $ guix graph --path elixir samba elixir@1.12.0 erlang@24.0.2 wxwidgets@3.0.5.1 webkitgtk@2.32.3 libsoup@2.72.0 samba@4.13.1 > What would be the recommended way to minimize the derivation? Examine each and try to spot what could be cut. For instance, ’erlang’ depends on ’wxwidgets’ which brings a lot of stuff. Hope that helps, simon