if I build an image like this:
docker build -f app/Dockerfile -t test .
it builds just fine, but the following docker-compose.yml
(which I believe should be equivalent):
app:
container_name: test
build:
context: .
dockerfile: app/Dockerfile
fails to build. if I run docker-compose with --verbose
I see:
compose.cli.verbose_proxy.proxy_callable: docker build <- (pull=False, stream=True, nocache=False, tag=u'prj_app', buildargs=None, rm=True, forcerm=False, path='/Users/ekkis/dev/prj', dockerfile='./app/Dockerfile')
which would seem pretty much what I expect. specifically the error I'm getting is this (sorry to include as code but quotes make a mess of things):
npm WARN app@1.0.0 No description
npm WARN app@1.0.0 No repository field.
npm ERR! Linux 4.9.12-moby
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "/tmp/inc"
npm ERR! node v7.7.3
npm ERR! npm v4.1.2
npm ERR! path /usr/src/app/node_modules/inc
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/usr/src/app/node_modules/inc'
npm ERR! enoent ENOENT: no such file or directory, access '/usr/src/app/node_modules/inc'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log
as you can see from the above, the Dockerfile performs an npm install /tmp/inc
, which from the output I see succeeded since it prints a tree of modules installed. /tmp/inc
is created by the Dockerfile command shown below as successful:
Step 8/11 : ADD inc /tmp/inc
---> Using cache
---> fce607bb13ca
and I note that the app/npm-debug.log
was not written to, nor is there a log file in the directory where I ran docker compose.
what could be the issue here? why does it build ok manually but not with docker-compose?
* Addendum I *
in my continuing efforts to figure it out, I added a directory listing before the Dockerfile executes the npm install...
Step 9/13 : RUN ls -alF
---> Running in ac0c62b7da93
total 28
drwxr-xr-x 3 root root 4096 Mar 19 07:01 ./
drwxr-xr-x 4 root root 4096 Mar 19 07:01 ../
-rw-r--r-- 1 root root 722 Mar 19 05:48 config.json
-rw-r--r-- 1 root root 3786 Mar 19 05:48 index.js
drwxr-xr-x 119 root root 4096 Mar 17 18:57 node_modules/
-rw-r--r-- 1 root root 2910 Mar 17 20:51 npm-debug.log
-rw-r--r-- 1 root root 416 Mar 19 06:39 package.json
...and, most interestingly, there is already a node_modules
directory there!! that means the problem is that docker-compose is not honouring the .dockerignore
file (which prevents copying **/node_modules
into the context)
so is there some special voodoo I have to perform for the build to generate the context properly?
via ekkis
No comments:
Post a Comment