I'm trying to dockerize a Vue SPA, but when I get to the below step during docker build .
# install simple http server for serving static content
RUN npm install -g http-server
I get the following after a few seconds:
Step 2/9 : RUN npm install -g http-server
---> Running in e30d7aa11a71
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/http-server failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-27T18_15_59_366Z-debug.log
I'm using the default Dockerfile from https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app.html so I expected it to just work out of the box
Building the image using docker run build . --network=host
fixed the issue for me.
The error I was getting was caused by Docker not being able to access the Internet, so spoonfeeding it "hey, just use host" seems to have fixed the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With