'Yarn install in Docker image
I have written a Docker file and I am installing Yarn in the container. But the yarn install/npm install doesn't seem to work. But when I run the yarn install outside the Docker file, it works completely fine. I have done the required proxy settings and everything but still no success.. Not sure why it's failing.
FROM nexus.corportation.com:8221/nodejs:latest
ARG SRCDIR
RUN mkdir /home/nodejs/app
RUN chown -R nodejs:nodejs /home/nodejs
#Ensure correct ownership
COPY $SRCDIR /home/nodejs/app/
USER root
RUN chown -R nodejs:nodejs /home/nodejs/app
#our user setup in the base container
USER nodejs
#Now using yarn
RUN /bin/bash -c 'source $HOME/.bashrc;cd app; yarn install'
ENTRYPOINT ["node", "app/javascript/index.js"]
EXPOSE 8080
But I get the following error:
error An unexpected error occurred: "https://nexus.corportation.com:8221/nexus/repository/npm-all/@xyz%2flt-navigator: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND http http:80".
This works fine outside Docker. I have tried to set the HTTP proxy along with Docker build but still not working.
Solution 1:[1]
Try mentioning the proxy in the docker file. Check what's the default docker network its using, that network should have access to the repo. ENV http_proxy ENV https_proxy ENV HTTP_PROXY ENV HTTPS_PROXY
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vicky |
