https://github.com/rsp/docker-experiments
Test what tools that are useful in shell scripts are available by default in Docker containers with some popular distribution minimal images (or any image).
It should work on any standard Linux distribution. If it doesn't, please sumbit an issue.
It is written and tested on Ubuntu 14.04 with Docker version 1.5.0, build a8a31ef.
Make sure you have sufficient permissions to run docker
.
You may need to run the scripts with: sudo ./script-name
.
You need to be in the same directory as the scripts
becasue they run each other with ./script-name
.
E.g. sudo ./check-images "centos debian ubuntu"
Checks if the given list of images can be run. Used by other scripts.
E.g. sudo ./system-info "centos debian ubuntu"
Shows the name and version of the operating system distribution that is run using that image name.
E.g. ./disk-usage "busybox debian ubuntu centos"
Show how much disk usage is shown by the command: du -sh
- see:
du(1)
.
E.g. `sudo ./test-commands "ubuntu centos" "perl python"
. | ubuntu | centos |
---|---|---|
perl | YES | NO |
python | NO | YES |
E.g. sudo ./real-commands "ubuntu centos" "sh perl python"
. | ubuntu | centos |
---|---|---|
sh | dash | bash |
perl | perl | - |
python | - | python2 |
Here are some results of experiments that were done with those scripts.
Here are the names and versions of OS distros used by some of the popular images - as of 2015-03-07:
Image | OS |
---|---|
debian | Debian GNU/Linux 7 (wheezy) |
ubuntu | Ubuntu 14.04.2 LTS |
centos | CentOS Linux 7 (Core) |
fedora | Fedora 21 (Twenty One) |
opensuse | openSUSE 13.2 (Harlequin) (x86_64) |
mageia | Mageia 4 |
busybox | Buildroot 2014.02 |
python | Debian GNU/Linux 8 (jessie) |
ruby | Debian GNU/Linux 8 (jessie) |
perl | Debian GNU/Linux 8 (jessie) |
php | Debian GNU/Linux 8 (jessie) |
gcc | Debian GNU/Linux 7 (wheezy) |
node | Debian GNU/Linux 8 (jessie) |
iojs | Debian GNU/Linux 8 (jessie) |
redis | Debian GNU/Linux 7 (wheezy) |
nginx | Debian GNU/Linux 7 (wheezy) |
postgres | Debian GNU/Linux 7 (wheezy) |
mysql | Debian GNU/Linux 7 (wheezy) |
mongo | Debian GNU/Linux 7 (wheezy) |
rethinkdb | Debian GNU/Linux 8 (jessie) |
wordpress | Debian GNU/Linux 8 (jessie) |
(This data was collected using the command: ./system-info "debian ubuntu centos fedora opensuse mageia busybox python ruby perl php gcc node iojs redis nginx postgres mysql mongo rethinkdb wordpress"
)
Almost every image except specific distributions seems to be based on Debian - some on version 7, some on 8.
Here is the disk usage of some of the popular images - as of 2015-03-07:
Image | Disk usage |
---|---|
busybox | 2.6M |
debian | 97M |
nginx | 106M |
redis | 123M |
mageia | 172M |
rethinkdb | 188M |
ubuntu | 209M |
centos | 224M |
postgres | 229M |
fedora | 254M |
mongo | 261M |
opensuse | 284M |
mysql | 289M |
php | 443M |
wordpress | 524M |
python | 708M |
iojs | 731M |
node | 740M |
perl | 754M |
ruby | 801M |
gcc | 1.5G |
(This data was collected using the command: ./disk-usage "debian ubuntu centos fedora opensuse mageia busybox python ruby perl php gcc node iojs redis nginx postgres mysql mongo rethinkdb wordpress"
)
Here are some interesting commands available in some popular images - as of 2015-03-08:
(This data was collected using the command: ./disk-usage "debian ubuntu centos ..." "perl python ruby ..."
Testing for some shells described in Unix shell - Shell categories on Wikipedia.
. | debian | ubuntu | centos | fedora | opensuse | mageia | busybox |
---|---|---|---|---|---|---|---|
sh | dash | dash | bash | bash | bash | bash | busybox |
ash | - | - | - | - | - | dash.static | busybox |
bash | bash | bash | bash | bash | bash | bash | - |
dash | dash | dash | - | - | - | - | - |
dash.static | - | - | - | - | - | dash.static | - |
ksh | - | - | - | - | - | - | - |
pdksh | - | - | - | - | - | - | - |
mksh | - | - | - | - | - | - | - |
zsh | - | - | - | - | - | - | - |
csh | - | - | - | - | - | - | - |
tcsh | - | - | - | - | - | - | - |
fish | - | - | - | - | - | - | - |
scsh | - | - | - | - | - | - | - |
busybox | - | - | - | - | - | - | busybox |
(data from 2015-03-17, collected on ./real-commands "debian ubuntu centos fedora opensuse mageia busybox" "sh ash bash dash dash.static ksh pdksh mksh zsh csh tcsh fish scsh busybox"
)
. | debian | ubuntu | fedora | centos |
---|---|---|---|---|
perl | YES | YES | - | - |
python | - | - | YES | YES |
python3 | - | YES | - | - |
lua | - | - | YES | YES |
ruby | - | - | - | - |
(data from 2015-03-14, collected with ./test-commands "debian ubuntu fedora centos" "perl python python3 lua ruby"
)
- Perl is available in Debian and Ubuntu, but not in Fedora and CentOS.
- Python 2 is available in Fedora and CentOS, but not in Debian and Ubuntu.
- Python 3 is available in Ubuntu, but not in Debian, Fedora and CentOS.
- Lua is available in Fedora and CentOS, but not in Debian and Ubuntu.
- Ruby is not available in either Debian, Ubuntu, Fedora or CentOS.
Those scripts are referenced in the following answers on Stack Exchange:
Rafał Pocztarski - https://github.com/rsp
MIT License (Expat). See LICENSE.md for details.