Reputation: 3076
I am unable to get my container to run after switching from using docker toolbox to docker for windows. After starting the container it just immediately fails with state EXIT 254
. This setup was working previously using virtualbox and I am quite stumped at what the problem could be. The build completes successfully.
This is the error:
frontend_1 | npm info it worked if it ends with ok
frontend_1 | npm info using [email protected]
frontend_1 | npm info using [email protected]
frontend_1 | npm ERR! Linux 4.4.15-moby
frontend_1 | npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev:no-debug"
frontend_1 | npm ERR! node v5.12.0
frontend_1 | npm ERR! npm v3.8.6
frontend_1 | npm ERR! path /usr/src/app/package.json
frontend_1 | npm ERR! code ENOENT
frontend_1 | npm ERR! errno -2
frontend_1 | npm ERR! syscall open
frontend_1 |
frontend_1 | npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
frontend_1 | npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
frontend_1 | npm ERR! enoent This is most likely not a problem with npm itself
frontend_1 | npm ERR! enoent and is related to npm not being able to find a file.
frontend_1 | npm ERR! enoent
frontend_1 |
frontend_1 | npm ERR! Please include the following file with any support request:
frontend_1 | npm ERR! /usr/src/app/npm-debug.log
This is my Dockerfile:
FROM node:5
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app/
CMD [ "npm", "run", "dev:no-debug" ]
This is the relevant compose file settings:
services:
frontend:
build:
context: ./frontend
volumes:
- ./frontend:/usr/src/app
- /usr/src/app/node_modules
expose:
- "7777"
environment:
- "PORT=7777"
- "VIRTUAL_PORT=7777"
- "VIRTUAL_HOST=test.example.com"
Edit: Add directory structure:
C
└---Users
|----deepc
|----docker
|----myproject
|---nginx
|---dockergen
|---frontend
---package.json, node_modules, src, Dockerfile
---docker-compose.yml
Upvotes: 1
Views: 1343
Reputation: 6482
I think this is hard to debug on a distance like this, but could you try building the container like this and see if it works?
FROM node:5
RUN mkdir -p /usr/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN npm install
CMD ["npm", "run", "dev:no-debug"]
I believe the issue is with:
no such file or directory, open '/usr/src/app/package.json'
...which tells me that the directory you expect to exist, doesn't! Not completely sure if you need to create the directory before copy, but it would help if you could give us the output of the build log.
Upvotes: 0
Reputation: 4222
In you compose.yml you mount this volume:
- ./frontend:/usr/src/app
So basically what you did earlier in your dockerfile is useless.
If you don't have a package.json in your frontend
folder, that's the problem
Upvotes: 1