title: "cp: Command not found" when recreating and extending centos6-i386 Docker base image
body: <p>I'm currently rebuilding our build server, and creating a set of Docker images for our various projects, as each has rather different toolchain and library requirements. Since Docker currently only runs on 64-bit hosts, the build server will be a x86_64 Fedora 22 machine.</p>
  
  <p>These images must be able to build historical/tagged releases of our projects without modification; we can make changes to the build process for each project if needed, but only for <em>current</em> trunk and <em>future</em> releases.</p>
  
  <p>Now, one of my build environments needs to reproduce an old i686 build server. For executing 32-bit programs I can simply install i686 support libraries (<code>yum install glibc.i686 ncurses-libs.i686</code>), but that doesn't help me to <em>build</em> 32-bit programs, without having to modify Makefiles to pass <code>-m32</code> to GCC &hellip; and, as stated above, I do not wish to alter historical codebases at all.</p>
  
  <p>So, my current idea is to basically fake a i686 version of CentOS in a Docker container by installing <em>all</em> i686 packages, including GCC. That way, although <code>uname -a</code> will report the host's x86_64 architecture, everything else within the container should be pretty consistent. I took the idea (and <code>centos6.tar.gz</code>) from <a href="https://hub.docker.com/r/toopher/centos-i386/~/dockerfile/" rel="nofollow">the "centos-i386" base image</a> which, in essence, I'm trying to reproduce for my own local image.</p>
  
  <p>Sadly, it's not going very well.</p>
  
  <p>Here's a minimal-ish <code>Dockerfile</code>:</p>
  
  <pre><code>FROM scratch
  
  
  # Inspiration from https://hub.docker.com/r/toopher/centos-i386/~/dockerfile/
  ADD centos6.tar.gz /
  RUN echo "i686" &gt; /etc/yum/vars/arch &amp;&amp; \
      echo "i386" &gt; /etc/yum/vars/basearch
  ENTRYPOINT ["linux32"]
  
  # Base packages
  RUN yum update -y &amp;&amp; yum -y install epel-release patch sed subversion bzip zip
  
  # AT91SAM9260 ARM compiler
  ADD arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 /usr/local/
  ENV PATH $PATH:/usr/local/arm-2009q1/bin
  
  # AT91SAM9260 &amp; native cxxtest
  ADD cxxtest-3.10.1.tar.gz /staging/
  WORKDIR /staging/cxxtest/
  RUN cp -r cxxtest /usr/local/arm-2009q1/arm-none-linux-gnueabi/include/
  RUN cp -r cxxtest /usr/local/include/
  RUN cp cxxtestgen.pl /usr/bin/
  RUN ln -s /usr/bin/cxxtestgen.pl /usr/bin/cxxtestgen
  WORKDIR /
  RUN rm -rf /staging/
  </code></pre>
  
  <p>The build fails on the first "<code>RUN</code>" in the cxxtest installation step:</p>
  
  <pre><code>/bin/sh: cp: command not found
  The command '/bin/sh -c cp -r cxxtest /usr/local/arm-2009q1/arm-none-linux-gnueabi/include/' returned a non-zero code: 127
  </code></pre>
  
  <p>What's wrong?</p>