i'm having a problem when i do docker run on a image that i created using this dockerfile:
FROM node
WORKDIR /Saiph
EXPOSE 3000
ENTRYPOINT ["npm", "start"]
COPY . /Saiph
RUN npm install
The error is this:
PS D:\saiph> docker run 1ba8ca0d9b3b
npm info it worked if it ends with ok
npm info using npm#5.3.0
npm info using node#v8.4.0
npm info lifecycle saiph#1.0.0~prestart: saiph#1.
npm info lifecycle saiph#1.0.0~start: saiph#1.0.0
> saiph#1.0.0 start /Saiph
> cd server && node server
sh: 1: cd: can't cd to server
npm info lifecycle saiph#1.0.0~start: Failed to e
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! saiph#1.0.0 start: `cd server && node server`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the saiph#1.0.0 start script.
I've tried to understand the error but i didn't understand it,
Sorry about my bad english,
Thanks
You issue is the difference between Windows and Linux file system. In windows if a folder named Server exists then you can use cd server or cd Server and it would work.
Linux is case sensitive. So either change your script to use the specific case or rename the folder from Server to server. You will need to do the same thing in code also to rename requires and other file related things to exact case
#TarunLalwani
PS D:\seith> docker run 15027498053c ls -al
total 72
drwxr-xr-x 1 root root 4096 Sep 9 19:15 .
drwxr-xr-x 1 root root 4096 Sep 9 19:16 ..
drwxr-xr-x 7 root root 4096 Sep 9 00:41 .git
-rwxr-xr-x 1 root root 6222 Sep 9 00:40 .gitignore
drwxr-xr-x 4 root root 4096 Sep 9 16:29 .vs
drwxr-xr-x 2 root root 4096 Sep 8 22:55 Client
drwxr-xr-x 3 root root 4096 Sep 9 00:38 Database
-rwxr-xr-x 1 root root 92 Sep 9 19:15 Dockerfile
-rwxr-xr-x 1 root root 1089 Sep 9 00:37 LICENSE
drwxr-xr-x 3 root root 4096 Sep 9 00:38 Server
drwxr-xr-x 76 root root 4096 Sep 9 16:29 node_modules
-rwxr-xr-x 1 root root 18807 Sep 9 19:15 package-lock.json
-rwxr-xr-x 1 root root 368 Sep 9 16:29 package.json
Related
I am having a hard time trying to build a docker image for some python project, but at some point a RUN command resulting content is not available in the next RUN.
I mean I have a RUN command that generate a directory with some content and that directory is not available for the next RUN command.
Here is the Dockerfile snippet :
RUN poetry config virtualenvs.create true && \
poetry config virtualenvs.in-project true && \
poetry install -n --no-root --no-dev && \
ls -la
RUN ls -la
The first ls -la shows a .venv directory (see below) while it is not present anymore in the second one.
And here is the build output:
Step 9/14 : RUN poetry config virtualenvs.create true && poetry config virtualenvs.in-project true && poetry install -n --no-root --no-dev && ls -la
---> Running in 3a93a4994133
...
drwxrwxr-x 4 root odoo 4096 Sep 29 20:08 .
drwxr-xr-x 1 root root 4096 Sep 16 02:35 ..
drwxr-xr-x 4 odoo odoo 4096 Sep 29 20:08 .venv
-rw-rw-r-- 1 odoo odoo 15824 Sep 2 23:18 poetry.lock
-rw-rw-r-- 1 odoo odoo 2057 Sep 2 23:50 pyproject.toml
drwxr-xr-x 3 odoo odoo 4096 Sep 29 20:08 src
Removing intermediate container 3a93a4994133
---> 694c4e54863c
Step 10/14 : RUN ls -la
---> Running in 5d0ebcf8f1e9
total 32
drwxrwxr-x 3 root odoo 4096 Sep 29 20:08 .
drwxr-xr-x 1 root root 4096 Sep 16 02:35 ..
-rw-rw-r-- 1 odoo odoo 15824 Sep 2 23:18 poetry.lock
-rw-rw-r-- 1 odoo odoo 2057 Sep 2 23:50 pyproject.toml
drwxr-xr-x 3 odoo odoo 4096 Sep 29 20:08 src
Removing intermediate container 5d0ebcf8f1e9
---> 750255eac6bb
If someone can provide any lead, it would be really appreciated.
Thanks
I would like to ask a question regarding the docker-compose.yml and Dockerfile.
Following is the situation I have met.
I first use docker image build (docker image build -t test .) and docker run (docker run -p 8888:8080 -p 8889:8009 8883:8443 -v tomcat8:/usr/local/tomcat8 --name test test) to test whether my Dockerfile is ready to go, and it is working.
Dockerfile
FROM ubuntu:latest
ENV HOME /usr/local/tomcat8
RUN apt-get -y update && apt-get -y install unzip wget openjdk-8-jdk
COPY ./installERDDAP.sh $HOME/installERDDAP.sh
COPY . $HOME/
RUN chmod +x $HOME/installERDDAP.sh
WORKDIR $HOME
RUN ./installERDDAP.sh
EXPOSE 8080 8443 8009
CMD ["catalina.sh","run"]
So that I script the docker-compose.yml, like below
docker-compose.yml
version: '3'
services:
erddap:
build:
context: ./
dockerfile: Dockerfile
image: erddap_dev:2.02
container_name: erddap
restart: always
ports:
- "8888:8080"
- "8883:8443"
- "8889:8009"
volumes:
- ./tomcat8:/usr/local/tomcat8
However, the error message popup and said that the file catalina.sh does not exist. When I get into the container, well, that is true. There are no files existed. But if I put RUN ls -la in the Dockerfile, I do see the files are listed, like below.
Step 12/14 : RUN ls -la
---> Running in fed4870bd617
total 176
drwxr-xr-x. 1 root root 4096 Sep 11 20:08 .
drwxr-xr-x. 1 root root 21 Sep 11 20:08 ..
drwxrwxr-x. 8 root root 166 Sep 11 19:31 .git
-rw-rw-r--. 1 root root 12 Sep 11 07:50 .gitignore
-rw-r--r--. 1 root root 165 Sep 11 20:08 .wget-hsts
-rw-r-----. 1 root root 19318 Jun 30 21:53 BUILDING.txt
-rw-r-----. 1 root root 5408 Jun 30 21:53 CONTRIBUTING.md
-rw-rw-r--. 1 root root 640 Sep 11 20:03 Dockerfile
-rw-r-----. 1 root root 57011 Jun 30 21:53 LICENSE
-rw-r-----. 1 root root 1726 Jun 30 21:53 NOTICE
-rw-r-----. 1 root root 3255 Jun 30 21:53 README.md
-rw-r-----. 1 root root 7136 Jun 30 21:53 RELEASE-NOTES
-rw-r-----. 1 root root 16262 Jun 30 21:53 RUNNING.txt
drwxr-x---. 2 root root 4096 Sep 11 20:08 bin
-rwxr-x---. 2 root root 25245 Jun 30 21:50 catalina.sh
drwx------. 2 root root 238 Jun 30 21:53 conf
drwxr-xr-x. 3 root root 20 Sep 11 20:08 content
drwxr-xr-x. 2 root root 6 Sep 11 20:08 data
drwxrwxr-x. 5 root root 44 Sep 11 03:46 doc
-rw-rw-r--. 1 root root 320 Sep 11 19:49 docker-compose.yml
-rwxrwxr-x. 1 root root 1030 Sep 11 19:41 installERDDAP.sh
drwxr-x---. 2 root root 4096 Sep 11 20:08 lib
drwxr-x---. 2 root root 6 Jun 30 21:49 logs
drwxr-xr-x. 2 root root 66 Sep 11 20:08 tarz
drwxr-x---. 2 root root 30 Sep 11 20:08 temp
drwxrwxr-x. 4 root root 29 Sep 11 19:41 tomcat8
drwxr-x---. 7 root root 99 Sep 11 20:08 webapps
drwxr-x---. 2 root root 6 Jun 30 21:49 work
Removing intermediate container fed4870bd617
Interestingly, these files are not also showing up in my volume directory. Could please someone tells me where am I wrong?
Thanks
1st Updates:
According to the suggestion below, if I commended out the volumes within docker-compose.yml or if I added WORKDIR / in front of the CMD command, none of them are working.
If I modified CMD commend in Dockfile from CMD ["catalina.sh","run"] to CMD ["./catalina.sh","run"] is not working, too. But if I changed to CMD ["/usr/local/tomcat8/catalina.sh","run"], the build process is completed. But the errors than become
Attaching to erddap
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
erddap | Cannot find /usr/local/bin/setclasspath.sh
erddap | This file is needed to run this program
2nd Updates:
installERDDAP.sh
#!/bin/bash
mkdir tarz
wget -q https://ftp.wayne.edu/apache/tomcat/tomcat-8/v8.5.57/bin/apache-tomcat-8.5.57.tar.gz -O ./tarz/apache-tomcat-8.5.57.tar.gz
tar -xf ./tarz/apache-tomcat-8.5.57.tar.gz -C /usr/local/tomcat8 --strip 1
mkdir data
ln ./bin/catalina.sh catalina.sh
From what I can tell your bind mount may be "overriding/hiding" your container files. If your "./tomcat8" directory is not empty it will basically "override/hide" the files in your container. I would remove the volume declaration to validate if this is the case, if so then you would need to clear out your "./tomcat8" directory and when you run the container again it should populate it with the files in the container, from then forward your local directory will again "override/hide" your container files.
In your docker file before the line CMD ["catalina.sh","run"] put WORKDIR / And change "catalina.sh" to "./catalina.sh"
In a Dockerfile, I have existing folders from my derived image /home and /root. I cannot create a folder in the /home directory:
RUN mkdir -p /home/TEST_3
No error messages are display but I can see that the folder was not created.
The same command is working fine in the /root directory
Bother folder seems to be similar in term of permission:
drwxr-xr-x 2 root root 4096 Apr 24 2018 home
drwx------ 1 root root 4096 Jun 20 08:38 root
The hard link count is different. The problematic folder /homehas more permission
Another strange thing is that I can create a folder in /home using:
WORKDIR /home/TEST_2
but then any file that I create in this folder doesn't seems to exist.
Here a small Dockerfile to recreate this issue/feature
# Specify the base image and tag
FROM gcr.io/deeplearning-platform-release/pytorch-cpu:m27
RUN ls -la
RUN ls -la /home/
RUN ls -la /root/
## creation ofthe folder is working and the folder exist (and I can create a file in the new folder)
RUN mkdir -p /root/TEST_1
RUN ls -la /root/TEST_1
RUN touch /root/TEST_1/new_file.txt
RUN ls -la /root/TEST_1
## creation of the folder is working and the folder exist but the file created doesn't exist
WORKDIR /home/TEST_2
WORKDIR /
RUN ls -la /home/TEST_2
RUN touch /home/TEST_2/new_file.txt
RUN ls -la /home/TEST_2
## creation of the folder succeed (no error messages), but the folder doesn't exist
RUN mkdir -p /home/TEST_3
RUN ls -la /home/TEST_3
RUN touch /home/TEST_3/new_file.txt
RUN ls -la /home/TEST_3
and here the output:
docker build -f Dockerfile_test .
Sending build context to Docker daemon 37.89kB
Step 1/17 : FROM gcr.io/deeplearning-platform-release/pytorch-cpu:m27
---> 7eb6565a8cc6
Step 2/17 : RUN ls -la
---> Running in 1ced0ed2bf49
total 80
drwxr-xr-x 1 root root 4096 Oct 26 12:52 .
drwxr-xr-x 1 root root 4096 Oct 26 12:52 ..
-rwxr-xr-x 1 root root 0 Oct 26 12:52 .dockerenv
drwxr-xr-x 1 root root 4096 Jun 20 08:20 bin
drwxr-xr-x 2 root root 4096 Apr 24 2018 boot
drwxr-xr-x 5 root root 340 Oct 26 12:52 dev
-rwxr-x--x 1 root root 94 Jun 19 21:51 entrypoint.sh
-rwxr-xr-x 1 root root 0 Jun 20 08:38 env.sh
drwxr-xr-x 1 root root 4096 Oct 26 12:52 etc
drwxr-xr-x 2 root root 4096 Apr 24 2018 home
drwxr-xr-x 1 root root 4096 Jun 20 08:22 lib
drwxr-xr-x 2 root root 4096 Jun 12 16:55 lib64
drwxr-xr-x 2 root root 4096 Jun 12 16:54 media
drwxr-xr-x 2 root root 4096 Jun 12 16:54 mnt
drwxr-xr-x 1 root root 4096 Jun 20 08:23 opt
dr-xr-xr-x 226 root root 0 Oct 26 12:52 proc
drwx------ 1 root root 4096 Jun 20 08:38 root
drwxr-xr-x 1 root root 4096 Jun 20 08:33 run
-rwxr-x--x 1 root root 109 Jun 19 21:51 run_jupyter.sh
drwxr-xr-x 1 root root 4096 Jun 20 08:20 sbin
drwxr-xr-x 2 root root 4096 Jun 12 16:54 srv
dr-xr-xr-x 13 root root 0 Oct 26 12:52 sys
drwxrwxrwt 1 root root 4096 Jun 20 10:09 tmp
drwxr-xr-x 1 root root 4096 Jun 20 08:33 usr
drwxr-xr-x 1 root root 4096 Jun 12 16:55 var
Removing intermediate container 1ced0ed2bf49
---> 87dbdffa7315
Step 3/17 : RUN ls -la /home/
---> Running in 756f013caf7f
total 8
drwxr-xr-x 2 root root 4096 Apr 24 2018 .
drwxr-xr-x 1 root root 4096 Oct 26 12:52 ..
Removing intermediate container 756f013caf7f
---> 24419a25ac99
Step 4/17 : RUN ls -la /root/
---> Running in bde249ae0452
total 52
drwx------ 1 root root 4096 Jun 20 08:38 .
drwxr-xr-x 1 root root 4096 Oct 26 12:52 ..
-rw-r--r-- 1 root root 3106 Apr 9 2018 .bashrc
drwxr-xr-x 3 root root 4096 Jun 20 08:31 .cache
drwxrwsr-x 1 root root 4096 Jun 20 08:26 .conda
drwx------ 4 root root 4096 Jun 20 08:33 .config
-rw-r--r-- 1 root root 401 Jun 20 08:33 .gitconfig
drwxr-xr-x 3 root root 4096 Jun 20 08:38 .ipython
drwxr-xr-x 1 root root 4096 Jun 20 10:10 .jupyter
drwxr-xr-x 3 root root 4096 Jun 20 08:31 .npm
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
-rw-r--r-- 1 root root 405 Jun 20 10:10 .wget-hsts
drwxrwxrwx 1 root root 4096 Jun 20 10:09 miniconda3
Removing intermediate container bde249ae0452
---> f6e6b3780145
Step 5/17 : RUN mkdir -p /root/TEST_1
---> Running in 95ffe0bc574f
Removing intermediate container 95ffe0bc574f
---> a87cac09ec17
Step 6/17 : RUN ls -la /root/TEST_1
---> Running in b8fd10afa3ee
total 8
drwxr-xr-x 2 root root 4096 Oct 26 12:52 .
drwx------ 1 root root 4096 Oct 26 12:52 ..
Removing intermediate container b8fd10afa3ee
---> 87b173385d4b
Step 7/17 : RUN touch /root/TEST_1/new_file.txt
---> Running in cbdd9ac79955
Removing intermediate container cbdd9ac79955
---> 0f57f2c15855
Step 8/17 : RUN ls -la /root/TEST_1
---> Running in 0a7d46a44e9e
total 8
drwxr-xr-x 1 root root 4096 Oct 26 12:53 .
drwx------ 1 root root 4096 Oct 26 12:52 ..
-rw-r--r-- 1 root root 0 Oct 26 12:53 new_file.txt
Removing intermediate container 0a7d46a44e9e
---> 5413892c3b96
Step 9/17 : WORKDIR /home/TEST_2
---> Running in d0322094ae3b
Removing intermediate container d0322094ae3b
---> 9815f6870830
Step 10/17 : WORKDIR /
---> Running in f84feebf3db9
Removing intermediate container f84feebf3db9
---> 5c85f2fadd04
Step 11/17 : RUN ls -la /home/TEST_2
---> Running in 4644cbcd5c3c
total 8
drwxr-xr-x 2 root root 4096 Oct 26 12:53 .
drwxr-xr-x 3 root root 4096 Oct 26 12:53 ..
Removing intermediate container 4644cbcd5c3c
---> c82625e638d9
Step 12/17 : RUN touch /home/TEST_2/new_file.txt
---> Running in ac89ce336a51
Removing intermediate container ac89ce336a51
---> d9569d5ca42d
Step 13/17 : RUN ls -la /home/TEST_2
---> Running in 999f75b4ece1
total 8
drwxr-xr-x 2 root root 4096 Oct 26 12:53 .
drwxr-xr-x 3 root root 4096 Oct 26 12:53 ..
Removing intermediate container 999f75b4ece1
---> 57062c0ccf0a
Step 14/17 : RUN mkdir -p /home/TEST_3
---> Running in f9788ac58dc7
Removing intermediate container f9788ac58dc7
---> e88a503ae524
Step 15/17 : RUN ls -la /home/TEST_3
---> Running in 16ea32c637c6
ls: cannot access '/home/TEST_3': No such file or directory
The command '/bin/sh -c ls -la /home/TEST_3' returned a non-zero code: 2
I am using Docker version 19.03.4, build 9013bf5 on MacOS 10.14.6
My questions are the following:
where is comming the difference (be able to create a folder in/root but not in /home
how to fix this issue to be able to create a folder in /home and
be able to create files as well in the new folder.
TL;DR
what is the difference between /home and /root
/home has a volume associated with it
how to get around the issue
create the file on entry-point (after the container is built), OR create the file inside the volume (I use the first option in my long answer)
Long answer:
Running a docker inspect containerId after building the Image & container show theirs a volumes assocated with the home directory:
"Source": "/var/lib/docker/volumes/1447dbc568742221a757a650427f38fb485e42fc7c6e959f33966922fe862d13/_data",
"Destination": "/home",
The volume is RW (read write), so you can write to the file once inside the container. (I tested using docker exec -it containerId /bin/sh then touch /home/TEST_2/new_file.txt)
Try using an Entrypoint script to create the folders/files.
Edit:
I wanted to see for myself, but ran into a couple hurdles. The parent container (gcr.io/deeplearning-platform-release/pytorch-cpu:m27) already has an entrypoint.sh file.
Also, adding a CMD or ENTRYPOINT command will override the parents entrypoint container (which you probably want).
Working Solution:
From the host, COPY the entrypoint.sh file (Assuming you want to modify it on your host). docker cp containerId:/entrypoint.sh .
Modify the entrypoint, adding your TOUCH commands:
#!/bin/bash
touch /home/TEST_2/new_file.txt # <-- I added this
. /env.sh
. /root/miniconda3/etc/profile.d/conda.sh
conda activate base
exec "$#"
Change your dockerfile to copy the new entrypoint.sh, which will replace the existing one:
COPY entrypoint.sh /entrypoint.sh
Your listing commands on startup will be the same, however if you go into the container you will see your file:
# ls home/TEST_2
new_file.txt
#
I'm trying to run a docker build which performs a maven build.
This is my Dockerfile:
FROM maven:3.5.4-jdk-8-slim
COPY * /myapp/src/
WORKDIR /myapp/src/
RUN mvn clean package
RUN ls -la target
RUN ls -la ./target
COPY ./target/myapp.jar ../
COPY config.yml ../
WORKDIR /myapp/
CMD ["java", "-jar", "myapp.jar"]
The issue I'm receiving is
COPY failed: stat /var/snap/docker/common/var-lib-docker/tmp/docker-builder185918822/target/myapp.jar: no such file or directory
I added the two ls statement for debugging purposes, this is the output:
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:27 min
[INFO] Finished at: 2018-10-30T13:59:42Z
[INFO] ------------------------------------------------------------------------
Removing intermediate container 5c0f369c5f9d
---> d2b36b5070e3
Step 5/10 : RUN ls -la target
---> Running in 4de6062b1573
total 19104
drwxr-xr-x 4 root root 4096 Oct 30 13:59 .
drwxr-xr-x 5 root root 4096 Oct 30 13:59 ..
drwxr-xr-x 2 root root 4096 Oct 30 13:59 classes
drwxr-xr-x 2 root root 4096 Oct 30 13:59 maven-archiver
-rw-r--r-- 1 root root 19538983 Oct 30 13:59 myapp.jar
-rw-r--r-- 1 root root 3294 Oct 30 13:59 original-myapp.jar
Removing intermediate container 4de6062b1573
---> 47f4a7534ffb
Step 6/10 : RUN ls -la ./target
---> Running in 55c68b1fbbe9
total 19104
drwxr-xr-x 4 root root 4096 Oct 30 13:59 .
drwxr-xr-x 5 root root 4096 Oct 30 13:59 ..
drwxr-xr-x 2 root root 4096 Oct 30 13:59 classes
drwxr-xr-x 2 root root 4096 Oct 30 13:59 maven-archiver
-rw-r--r-- 1 root root 19538983 Oct 30 13:59 myapp.jar
-rw-r--r-- 1 root root 3294 Oct 30 13:59 original-myapp.jar
Removing intermediate container 55c68b1fbbe9
---> bbc8a395474c
Step 7/10 : COPY ./target/myapp.jar ../
COPY failed: stat /var/snap/docker/common/var-lib-docker/tmp/docker-builder185918822/target/myapp.jar: no such file or directory
As you can see from the output of both ls commands, the jar file is there. Why is docker failing to find it?
I'm getting started on my first docker script and i'm trying to debug the last step and it's very slow debugging b/c the steps before it take a few minutes to run so if i have a typo, i have to re run the entire script.
Is there a more efficient way to debug a docker script? or do i have to rebuild the whole thing every time?
#FROM ubuntu:14.04
FROM node:0.10.40
#FROM mongo:2.6.11
# The port we're running the server on
EXPOSE 10645
# Set this as the working directory
WORKDIR /myproject/hapi
# Move the myproject files to /myproject in the docker container
ADD . /myproject/hapi
# Install the server dependencies
RUN pwd && ls -al && npm install
# Start everything up
CMD npm start
Log output:
^CR5033505:myproject m089269$ docker build -t myproject-hapi .
Sending build context to Docker daemon 932.2 MB
Step 0 : FROM node:0.10.40
---> a7d8016a6fdb
Step 1 : EXPOSE 10645
---> Running in ebc4f8ebbf7b
---> 701320586e6a
Removing intermediate container ebc4f8ebbf7b
Step 2 : WORKDIR /myproject/hapi
---> Running in 1998f97b252a
---> 1414baf38920
Removing intermediate container 1998f97b252a
Step 3 : ADD . /myproject/hapi
---> c80e665da20b
Removing intermediate container f6904fab79ce
Step 4 : RUN pwd && ls -al && npm install
---> Running in a3ef28ed70ae
/myproject/hapi
total 68
drwxr-xr-x 9 root root 4096 Oct 30 18:35 .
drwxr-xr-x 3 root root 4096 Oct 30 18:35 ..
-rw-r--r-- 1 root root 509 Apr 10 2015 .editorconfig
drwxr-xr-x 8 root root 4096 Oct 30 18:33 .git
-rw-r--r-- 1 root root 491 Oct 20 15:09 .gitignore
drwxr-xr-x 8 root root 4096 Aug 19 14:51 .idea
-rw-r--r-- 1 root root 1781 Apr 10 2015 .jscsrc
-rw-r--r-- 1 root root 6164 Apr 10 2015 .tfignore
-rw-r--r-- 1 root root 430 Oct 30 18:33 Dockerfile
-rw-r--r-- 1 root root 371 Oct 30 18:16 Dockerfile-client
-rwxr-xr-x 1 root root 1374 Oct 30 15:15 README.md
drwxr-xr-x 5 root root 4096 Oct 21 21:18 ab-testing-deploy
drwxr-xr-x 3 root root 4096 Oct 30 15:15 build
drwxr-xr-x 14 root root 4096 Oct 30 15:15 client
drwxr-xr-x 2 root root 4096 Apr 10 2015 githooks
drwxr-xr-x 10 root root 4096 Oct 30 15:15 hapi
npm ERR! install Couldn't read dependencies
npm ERR! Linux 4.1.10-boot2docker
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.40
npm ERR! npm v2.14.1
npm ERR! path /myproject/hapi/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR! package.json ENOENT, open '/myproject/hapi/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! Please include the following file with any support request:
npm ERR! /myproject/hapi/npm-debug.log
The command '/bin/sh -c pwd && ls -al && npm install' returned a non-zero code: 34
Unfortunately when you're doing your ADD command you're invalidating the docker build cache, so any commands after that will be run from scratch. From the docs:
Note: The first encountered ADD instruction will invalidate the cache for all following instructions from the Dockerfile if the contents of have changed. This includes invalidating the cache for RUN instructions.
https://docs.docker.com/reference/builder/#add
I think in this case it would be easiest to run an interactive container and run each command from your Dockerfile one by one so you can see which one fails and be in a position to run it again immediately after you attempt to fix the error.
For example:
docker run -ti -v /path/to/your/code:/myproject/hapi node:0.10.40 bash
$ cd /myproject/hapi
$ npm install
Then when you do an ls -la you'll be able to see that package.json either isn't there or something else is wrong, and once you've figured it out you can add that command into your Dockerfile.