Docker Community Forums

Share and learn in the Docker community.

Container runs first time, but always crashes when started later

The following comes from a simple example of Docker in Practice (Manning publishing).

When I run the following Dockerfile the first time, it works fine. But if I stop it and then try to start it, it fails with the following error every time.

Dockerfile:
FROM node
LABEL maintainer thisguy
RUN git clone -q https://github.com/docker-in-practice/todo.git
WORKDIR todo
RUN npm install > /dev/null
EXPOSE 8000
CMD [“npm”, “start”]

Error:

todomvc-swarm@0.0.1 start /todo
node TodoAppServer.js

fs.js:161
throw new ERR_INVALID_CALLBACK(cb);
^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
at makeCallback (fs.js:161:11)
at Object.rename (fs.js:747:14)
at FileStorage.rotateLog (/todo/node_modules/swarm/lib/FileStorage.js:122:16)
at new FileStorage (/todo/node_modules/swarm/lib/FileStorage.js:25:10)
at Object. (/todo/TodoAppServer.js:88:19)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: ‘ERR_INVALID_CALLBACK’
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todomvc-swarm@0.0.1 start: node TodoAppServer.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todomvc-swarm@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-01T23_45_12_923Z-debug.log

I have tried this with Docker Desktop (latest version) in both Ubuntu (20.04.1) and in Pengwin (11), with the same results. Any help would be greatly appreciated.
Thank you.
Bruce.