0

I'm trying to run NPM install commands from within my Dockerfile during docker build in a windows container. The problem is that NPM cannot resolve the package registry and as a matter of fact no domain can be resolved because the DNS is not properly configured.

I tried running a RUN command in the Dockerfile to update the dns: RUN netsh interface ip set dns "Ethernet 2" static 8.8.8.8 but it doesn't seem to work although the build finishes properly.

Is this even possible. Please note that I want to achieve this from within the Dockerfile during a docker build. Running a container with --dns 8.8.8.8 works fine etc but that's not my goal.

EDIT: Adding sample Dockerfile

FROM randomimage:latest

COPY NodeDir C:/NodeDir
SHELL ["cmd", "/S", "/C"]
RUN .\node-vX.msi /quiet

# I also tried with SHELL ["netsh", "interface", "ip"], no luck
RUN netsh interface ip set dns "Ethernet 2" static 8.8.8.8
RUN npm i gulp -g
CMD cmd
PentaKon
  • 4,139
  • 5
  • 43
  • 80

0 Answers0