Closed PavolTomana closed 4 years ago
Hmm - looks like it's getting stuck on the npm install
line, then. docker build
will run it on your local system - are you behind any firewalls that might block access to the npm repos?
yes, i am behind firewalls. Is there some way how to test connections to npm repositories ?
add --verbose
to the npm install command - that should have it spit out all the connections it's trying to make (and presumably failing on).
alternately, assuming you have the ibmcloud
cli installed with the container-registry
plugin, you can build it directly in our registry (skip the local copy) using something like
ibmcloud cr build --tag registry.eu-gb.bluemix.net/<namespace>/hello-world:1 .
instead
I'm not able to "debug" npm install even with --verbose
, no output it is just stucked, and also there stay running process with high cpu consumption, which has to be killed manually.
But i'm able to build image directly in ibmcloud container registry.
Thanks a lot!
I would like to add that I had the same problem when building docker images with gitlab CI and gitlab runner. Might it be because we use .npmrc
?
Removing intermediate container 00908dc0e5b7
---> 9f9991dcf84c
Step 9/41 : COPY package.json ./
---> a87c9c6ce6c3
Step 10/41 : COPY package-lock.json ./
---> 0503e118aaf1
Step 11/41 : COPY .npmrc ./
---> 75503f310cb2
Step 12/41 : RUN npm install
---> Running in 9b19d5d3cc09
@Dyktus it is quite possible the .npmrc is the cause, hard to know without knowing what is in the .npmrc file.
Using the container-registry plugin to build in the cloud is definitely a good option when dealing with a strange local environment
$ docker build --tag us.icr.io/test/hello-world .
Sending build context to Docker daemon 14.85kB
Step 1/6 : FROM node:9.4.0-alpine
---> b5f94997f35f
Step 2/6 : COPY app.js .
---> Using cache
---> 70649a5d21a9
Step 3/6 : COPY package.json .
---> Using cache
---> bcaae59ee3c2
Step 4/6 : RUN npm install && apk update && apk upgrade
---> Running in 6e86a37b03f6
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/unpipe-962f02c0/package.json'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/unpipe-962f02c0/README.md'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/finalhandler-4fdafa9f/package.json'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/unpipe-962f02c0/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/finalhandler-4fdafa9f/HISTORY.md'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/unpipe-962f02c0/index.js'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/finalhandler-4fdafa9f/index.js'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/unpipe-962f02c0/HISTORY.md'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/finalhandler-4fdafa9f/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/finalhandler-4fdafa9f/README.md'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/mime-db-d8839dfc/HISTORY.md'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/mime-db-d8839dfc/index.js'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/mime-db-d8839dfc/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/node_modules/.staging/mime-db-d8839dfc/README.md'
npm WARN hello-world-demo@0.0.1 No repository field.
npm WARN hello-world-demo@0.0.1 No license field.
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-10-24T08_39_30_892Z-debug.log
The command '/bin/sh -c npm install && apk update && apk upgrade' returned a non-zero code: 1
Is it like dependencies are missing some files? the Lab tried - 24th of October 2019
npm ERR! request to https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
Doesn’t seem like your machine could reach the npm site. Could be a transient error or you you have something blocking your connection there.
true, seems to be docker/network issue, following this one - gets resolved https://github.com/moby/moby/issues/32106#issuecomment-382228854
Sorry, for bothering guys.
Hello, have somebody idea where could be problem. I adjust Dockerfile to find out on which line it hangs. I'm beginner in this linux/docker stuff.
note: namespace - just for publication purpose
Thanks!