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 cloud node BYON is unreachable
  • Handshake Exception in Liberty Profile with Docker
  • How specify the size of a shared Docker volume?
  • How to monitor Nodejs app running on Kubernetes
  • libcontainer - system programmers perspective
  • In docker,how to close the port expose by dockerfile?
  • 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?

  • Docker gd module for PHP 7
  • How do I serve Kinto via https from a docker container?
  • Defining services in kubelet manifest
  • How to mount current directory as read-only but still allow changes inside the container?
  • Requirement to accept network packets in container from host or outside? (docker port forwarding)
  • Marathon With Private Docker Repo
  • 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.