Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
Node.js docker can't install npm dependencies

I have this Dockerfile

FROM node:14

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE 3000

CMD [ "node", "app.mjs" ]

And I can successfully run

docker run hello-world

on my ubuntu 20.10 OS. So I am assuming that docker is installed successfully. But when I tried to run

docker build .

It gives me this error

enter image description here

This is not something with the npm. I can locally install the dependencies without any issue. I assume Dokcer can't access npm registry to pull the npm packages. Something to do with networks I guess.

How do I fix this issue?

This is my code https://github.com/Enuri-Information-Systems/docker-test

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Depending on the network configuration it could happen that you run into problems that the container is not able to connect to a server to download data. This can have various reasons and also depends on how you run docker.

One common thing is that your network requires the usage of a proxy. But only having the error message it is not possible to tell what the exact reason in your case is.

One solution to that problem is to specify the network mode. Adding --network host as an option should most of the time work.

So running your build command that way docker build --network=host . should work.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda