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):

  • Automate adding new Node Exporters to the targets array of prometheus.yml
  • Docker 1.12 Swarm Overlay Network Published Port
  • Accessing the number of arguments pass into a docker run command script
  • How to reduce my java/gradle docker image size?
  • Cannot connect to MySQL docker container from container with Django app
  • How can you write a docker daemon that can kick off other docker containers as needed?
  • 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?

  • terraform provider + docker registry v2 = 404
  • How do you get around the size limitation of Docker.qcow2 in the Docker for Mac?
  • Docker with one nginx and one uwsgi container that is sharing a UNIX socket
  • How stop containers run with `docker-compose run`
  • How to change docker container's source code without restarting it?
  • Docker swarm on AWS - swarm services cannot access internet
  • 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.