Docker: Unable to execute RUN command after ADD when starting from scratch

I’m trying to build a custom Linux Alpine docker for ARM architecture starting from the “scratch” image. I don’t understand why I can’t execute any RUN command after I execute ADD. This is my Dockerfile:

FROM scratch
ADD rootfs.tar /

MAINTAINER Vittorio_Cozzolino

RUN apk add nodejs

And this is the output that I get when the automated build completes (the last line contains the error):

  • Docker save read arguments from stdin
  • In Docker, can I use the JSON format for entrypoint from the command line?
  • Docker and Nginx proxy_pass between containers
  • Setting fixed address/network for docker0 bridge interface on Ubuntu
  • Docker hub/registry automated build from github build details log
  • remote server returned 400 bad request for apache2 in ubuntu
  • Client:  Version:      1.8.1  API version:  1.20  Go version:  
    go1.4.2  Git commit:   d12ea79  Built:        Thu Aug 13 02:49:29 UTC
    2015  OS/Arch:      linux/amd64
    
    Server:  Version:      1.8.3-rc1  API version:  1.20  Go version:  
    go1.4.2  Git commit:   6f21aba  Built:        Mon Sep 28 20:03:03 UTC
    2015  OS/Arch:      linux/amd64 Step 0 : FROM scratch
     ---> Step 1 : ADD rootfs.tar /
     ---> dd771ffd56ea702 Step 2 : MAINTAINER Vittorio_Cozzolino
     ---> 825fc4c990c8a33 Step 3 : RUN apk add nodejs [91mexec: "/bin/sh": stat /bin/sh: no such file or directory
    

    Actually /bin/sh exists and, in fact, if I run CMD ["/bin/sh"] I don’t get any error. Can anyone help me here?

  • Single docker container slightly outperforming its host in cpu performance: Why?
  • How to configure Docker in windows to listen to tcp?
  • Docker backups from host vs data volume containers?
  • --cap-add in Google Container Engine
  • Docker difference in start and stop times
  • How can I tell if docker has frozen?
  • One Solution collect form web for “Docker: Unable to execute RUN command after ADD when starting from scratch”

    CMD ["/bin/sh"] is a simple declaration of the default command to run, so it will always work.

    Check if the tar is indeed unpacked, as there was a similar issue in 9541: limit your Dockerfile to the ADD directive, and use docker exec or a simple ls to see what is in there (and with which owner/permission).
    If the Dockerfile complains about a missing /bin/sh, and /bin/sh is in the tar archive… chances are that archive didn’t uncompress properly.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.