When I try df -h for busybox container I get the following results:
$ docker run -it busybox du -h
# expected results
What I need is the output of df -b which gives me the following:
$ docker run -it busybox du -b
du: invalid option -- b
BusyBox v1.30.0 (2018-12-31 18:16:17 UTC) multi-call binary.
Usage: du [-aHLdclsxhmk] [FILE]...
Summarize disk space used for each FILE and/or directory
-a Show file sizes too
-L Follow all symlinks
-H Follow symlinks on command line
-d N Limit output to directories (and files with -a) of depth < N
-c Show grand total
-l Count sizes many times if hard linked
-s Display only a total for each argument
-x Skip directories on different filesystems
-h Sizes in human readable format (e.g., 1K 243M 2G)
-m Sizes in megabytes
-k Sizes in kilobytes (default)
As many of the standard utilites are trimmed in busybox image or non-existent, the behaviour is not surprising. As dockerhub's busybox page suggests:
FROM busybox COPY ./my-static-binary /my-static-binary CMD ["/my-static-binary"]
So, I created a Dockerfile with the following content trying to copy my Ubuntu 16.04 du binary to the image:
FROM busybox
COPY /usr/bin/du /bin/du
CMD ["/bin/du", "-b"]
But when I try docker build I get the following error:
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM busybox
---> 3a093384ac30
Step 2/3 : COPY /usr/bin/du /bin/du
COPY failed: stat /var/lib/docker/tmp/docker-builder362173879/usr/bin/du: no such file or directory
I don't know if it's the right way of adding utilities to such minimal images, but I would appreciate if you let me know the ways that utilities such as (complete) du, curl, etc. could be added given that there is no package manager like apt.