Arquivo Dockerfile:
FROM node:latest
MAINTAINER Marina Micas
COPY . /var/www
WORKDIR /var/www
RUN npm install
ENTRYPOINT npm start
EXPOSE 3000
No terminal do Ubuntu:
marinamicas@desenv:~/Downloads/volume-exemplo$ sudo docker run -p 8181:3000 -v "$(pwd):/var/www" -w "/var/www" node npm install -g jshint --save && npm start
[sudo] senha para marinamicas:
/usr/local/bin/jshint -> /usr/local/lib/node_modules/jshint/bin/jshint
+ jshint@2.10.3
added 31 packages from 15 contributors in 1.632s
> volume-exemplo@1.0.0 start /usr/src/app
> node .
module.js:550
throw err;
^
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/src/app/index.js:1:79)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! volume-exemplo@1.0.0 start: `node .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the volume-exemplo@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-12-11T14_40_43_723Z-debug.log
marinamicas@desenv:~/Downloads/volume-exemplo$
Eu não consegui sair dessa parte da aula 4 do curso de Docker, e eu segui com o mesmo tipo de código que deu meio certo ao tentar rodar a página dentro de um container da aula anterior. Help me!!!