I had the same problem, it turned out that the Docker tutorial is a bit ambiguous and makes it easy to corrupt the directory tree if you don't understand the behavior of COPY.
I had this directory tree:
workdir/Dockerfile workdir/src/package.json workdir/src/index.js
COPY . /src team COPY . /src COPY . /src leads to the following tree in the Docker image:
/src/Dockerfile /src/src/package.json /src/src/index.js
So put package.json and index.js in the same folder as your Docker file, and it should work fine.
One more thing, when debugging a failed build like this, you can use the image identifier to look into the directory tree, even if the container is not running. For example, given the following output from docker build :
Step 4: RUN cd /src; npm install ---> Running in 4bce6ad89dab ---> 3084f3523d93 ERROR! BAD THINGS! PANIC!
The image ID in this case is 3084f3523d93 , so you can run docker run --rm 3084f3523d93 ls -lR /src to check the / src directory and see what went wrong. Alternatively, use /bin/bash instead of ls -lR /src to get a shell and pop.
source share