title: Adding Linux utilities to docker image based on busybox
body: <p>When I try <code>df -h</code> for busybox container I get the following results:</p>
  
  <pre><code>$ docker run -it busybox du -h  
  # expected results
  </code></pre>
  
  <p>What I need is the output of <code>df -b</code> which gives me the following:</p>
  
  <pre><code>$ 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 &lt; 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)
  </code></pre>
  
  <p>As many of the standard utilites are trimmed in busybox image or non-existent, the behaviour is not surprising. As dockerhub's busybox page <a href="https://hub.docker.com/_/busybox" rel="nofollow noreferrer">suggests</a>: </p>
  
  <blockquote>
  <pre><code>FROM busybox
  COPY ./my-static-binary /my-static-binary
  CMD ["/my-static-binary"]
  </code></pre>
  </blockquote>
  
  <p>So, I created a Dockerfile with the following content trying to copy my Ubuntu 16.04 <code>du</code> binary to the image:</p>
  
  <pre><code>FROM busybox
  COPY /usr/bin/du /bin/du
  CMD ["/bin/du", "-b"]
  </code></pre>
  
  <p>But when I try <code>docker build</code> I get the following error:</p>
  
  <pre><code>$ docker build .              
  Sending build context to Docker daemon  2.048kB
  Step 1/3 : FROM busybox
   ---&gt; 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
  </code></pre>
  
  <p>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) <code>du</code>, <code>curl</code>, etc. could be added given that there is no package manager like <code>apt</code>.</p>