0

While trying Docker Tutorial https://prakhar.me/docker-curriculum/#dockerrun getting error while running root@ip-172-31-22-20:~/docker-curriculum# docker build -t ashishkarpe/foodtrucks-web .

root@ip-172-31-22-20:~/docker-curriculum# docker build -t ashishkarpe/foodtrucks-web .
Sending build context to Docker daemon 5.32 MB
Step 1 : FROM ubuntu:14.04
---> 3f755ca42730
Step 2 : MAINTAINER Prakhar Srivastav prakhar@prakhar.me
---> Using cache
---> ca0cf0254114
Step 3 : RUN apt-get -yqq update
---> Using cache
---> 4952fb95a34d
Step 4 : RUN apt-get -yqq install python-pip python-dev
---> Using cache
---> 73bd849c6164
Step 5 : RUN apt-get -yqq install nodejs npm
---> Using cache
---> c48d602eccda
Step 6 : RUN ln -s /usr/bin/nodejs /usr/bin/node
---> Using cache
---> 221206c99a7f
Step 7 : ADD flask-app /opt/flask-app
---> Using cache
---> 7ddfac0cdf0e
Step 8 : WORKDIR /opt/flask-app
---> Using cache
---> 451217e08677
Step 9 : RUN npm install
---> Running in 547c36e97297

npm ERR! install Couldn't read dependencies
npm ERR! Error: ENOENT, open '/opt/flask-app/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com

npm ERR! System Linux 3.13.0-92-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /opt/flask-app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /opt/flask-app/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/flask-app/npm-debug.log
npm ERR! not ok code 0

My Docker File :

# cat Dockerfile
# start from base
FROM ubuntu:14.04
MAINTAINER Prakhar Srivastav <prakhar@prakhar.me>

# install system-wide deps for python and node
RUN apt-get -yqq update
RUN apt-get -yqq install python-pip python-dev
RUN apt-get -yqq install nodejs npm
RUN ln -s /usr/bin/nodejs /usr/bin/node

# copy our application code
ADD flask-app /opt/flask-app
WORKDIR /opt/flask-app

# fetch app specific deps
RUN npm install
RUN npm run build
RUN pip install -r requirements.txt

# expose port
EXPOSE 5000
Ashish Karpe
  • 277
  • 2
  • 5
  • 19

1 Answers1

1

This is error thrown due to expiry of npm for Ubuntu 14.04 to get around quick fix add lines

ADD package.json /opt/flask-app
RUN npm config set strict-ssl false

After these lines

# copy our application code
ADD flask-app /opt/flask-app
WORKDIR /opt/flask-app
Alexander Tolkachev
  • 4,513
  • 3
  • 14
  • 23