2

Below is my Dockerfile my-docker-file.

FROM ubuntu:14.04 RUN apt-get update RUN apt-get -y upgrade RUN apt-get install -y python python-pip git-all python-dev libxml2-dev libxslt1-dev libmysqlclient-dev gunicorn python-pycurl libcurl4-openssl-dev RUN apt-get install -y rubygems-integration inotify-tools RUN gem install sass -v 3.3.14 RUN apt-get install -y nodejs RUN apt-get install -y npm RUN npm install jsmin -g 

But it fails in the last step (see below). Why is this happening and how can I fix??

$ docker build -f /path/to/my/project/my-docker-file . <... FIRST EIGHT STEPS SNIPPED ...> ---> 742601020ac5 Step 9/9 : RUN npm install jsmin -g ---> Running in 6528f8aa90cc npm http GET https://registry.npmjs.org/jsmin npm http GET https://registry.npmjs.org/jsmin npm http GET https://registry.npmjs.org/jsmin npm ERR! Error: CERT_UNTRUSTED npm ERR! at SecurePair.<anonymous> (tls.js:1370:32) npm ERR! at SecurePair.EventEmitter.emit (events.js:92:17) npm ERR! at SecurePair.maybeInitFinished (tls.js:982:10) npm ERR! at CleartextStream.read [as _read] (tls.js:469:13) npm ERR! at CleartextStream.Readable.read (_stream_readable.js:320:10) npm ERR! at EncryptedStream.write [as _write] (tls.js:366:25) npm ERR! at doWrite (_stream_writable.js:223:10) npm ERR! at writeOrBuffer (_stream_writable.js:213:5) npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:180:11) npm ERR! at write (_stream_readable.js:583:24) 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! <[email protected]> npm ERR! System Linux 4.9.87-linuxkit-aufs npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "jsmin" "-g" npm ERR! cwd / npm ERR! node -v v0.10.25 npm ERR! npm -v 1.3.10 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /npm-debug.log npm ERR! not ok code 0 The command '/bin/sh -c npm install jsmin -g' returned a non-zero code: 1 

2 Answers 2

3

Not the best solution, but this is what worked for me in this case

FROM ubuntu:14.04 RUN apt-get update RUN apt-get -y upgrade RUN apt-get install -y python python-pip git-all python-dev libxml2-dev libxslt1-dev libmysqlclient-dev gunicorn python-pycurl libcurl4-openssl-dev RUN apt-get install -y rubygems-integration inotify-tools RUN gem install sass -v 3.3.14 RUN apt-get install -y nodejs RUN apt-get install -y npm RUN npm config set strict-ssl false <-- Ignore the SSL cert RUN npm install jsmin -g 

Update:

A better solution is to use the http version of the npm registry as below

FROM ubuntu:14.04 RUN apt-get update RUN apt-get -y upgrade RUN apt-get install -y python python-pip git-all python-dev libxml2-dev libxslt1-dev libmysqlclient-dev gunicorn python-pycurl libcurl4-openssl-dev RUN apt-get install -y rubygems-integration inotify-tools RUN gem install sass -v 3.3.14 RUN apt-get install -y nodejs RUN apt-get install -y npm RUN npm config set registry http://registry.npmjs.org/ RUN npm install jsmin -g 
Sign up to request clarification or add additional context in comments.

Comments

0

The error because untrusted repository when try to install nodejsError: CERT_UNTRUSTED

May be you can try to change the installation of nodejs to be like this

RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - RUN apt-get install -y nodejs 

1 Comment

That didn't help :(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.