Docker images require appropriate shared object files (".so") to run. Rather than assume Ubuntu has the correct lib's, use ldd to get a list and install the ones you know you need. This can reduce the underlying images from GB to a few MB.
6. Distributing Docker Images
Why distro?
Shared Object Lib's (.so).
Your executable + Ubuntu != runnable.
Except when it isn't.
7. Docker is not a VM
Execuatables use versions of lib's.
Not all versions are [bug-] compatible.
RH/SuSE/Arch/Gentoo + Ubuntu == ???
libc differences are the worst.
What you need are your libs.
8. Q: How to distribute?
One approach: Dup /lib*, /usr/lib* .
4 /lib32
38 /lib64
372 /usr/lib32
2526 /usr/lib64
About 3GB on my notebook.
Development server? (ouch)
12. What don't you need?
Then again, not everything needs shared lib's:
$ ldd /opt/perl/lib/5.22.0/NEXT.pm
ldd: warning: you do not have execution permission for
`/opt/perl/lib/5.22.0/NEXT.pm'
not a dynamic executable
13. Q: How do you ask for what you need?
More than one way...
14. 1. Scan it all.
Scan all of perl5's lib.
ldd everything.
filter out rejects.
uniq the rest.
Good: One image for everything.
Bad: Big (?)
15. 2. Scan current
Construct docker's source directory.
Scan that with ldd.
App From "-libs" image.
Good: Small.
Bad: More work.
16. 2. Scan current
Construct docker's source directory.
Scan that with ldd.
App From "-libs" image.
Good: Small.
Bad: More work.
Good: Easy to automate.
17. Q: Which PM's do I need?
A: Ask perl.
%INC has all of your module paths.
x %INC
0 HASH(0x24d8070)
'/opt/perl/5.22/lib/site_perl/5.22.0/x86_64-
linux/auto/Term/ReadLine/Gnu/XS/autosplit.ix' =>
'/opt/perl/5.22/lib/site_perl/5.22.0/x86_64-
linux/auto/Term/ReadLine/Gnu/XS/autosplit.ix'
'AutoLoader.pm' => '/opt/perl/5.22/lib/5.22.0/AutoLoader.pm'
'B.pm' => '/opt/perl/5.22/lib/5.22.0/x86_64-linux/B.pm'
18. Q: Which PM's do I need?
A: Ask perl.
%INC has all of your module paths.
Hard to export for arbitrary program.
x %INC
0 HASH(0x24d8070)
'/opt/perl/5.22/lib/site_perl/5.22.0/x86_64-
linux/auto/Term/ReadLine/Gnu/XS/autosplit.ix' =>
'/opt/perl/5.22/lib/site_perl/5.22.0/x86_64-
linux/auto/Term/ReadLine/Gnu/XS/autosplit.ix'
'AutoLoader.pm' => '/opt/perl/5.22/lib/5.22.0/AutoLoader.pm'
'B.pm' => '/opt/perl/5.22/lib/5.22.0/x86_64-linux/B.pm'
19. So: Bulk is it.
cd /opt/perl;
find -H lib bin -type f |
xargs ldd 2>/dev null |
grep '.so' | grep -v ':$';
22. Menagrie of sharing
linux-vdso.so.1 (0x00007ffe8d3f6000)
Q: Why no path?
A: This is a kernel binding.
No file on disk.
Be careful what you search for!