Tôi có Dockerfile này:Docker: NPM cài đặt đằng sau Proxy
FROM node:argon
ENV http_proxy http://user:[email protected]:3128
ENV https_proxy https://user:[email protected]:3128
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install
# Bundle app source
COPY . /usr/src/app
EXPOSE 8080
CMD [ "npm", "start" ]
Nhưng tôi nhận được lỗi này, trong NPM cài đặt bước:
npm info it worked if it ends with ok npm info using [email protected] npm info using [email protected] npm WARN package.json [email protected] No description npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No README data npm info preinstall [email protected] npm info attempt registry request try #1 at 7:09:23 AM npm http request GET https://registry.npmjs.org/body-parser npm info attempt registry request try #1 at 7:09:23 AM npm http request GET https://registry.npmjs.org/express npm info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=write EPROTO npm info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=write EPROTO
Tôi đoán đó là do proxy. Tôi cũng đã cố gắng đặt
RUN npm config set proxy http://user:[email protected]:3128
RUN npm config set https-proxy http://user:[email protected]:3128
nhưng vẫn gặp lỗi tương tự.
Hơn nữa, trong hồ sơ của tôi /etc/systemd/system/docker.service.d/http-proxy.conf Tôi có điều này:
Environment="HTTP_PROXY=http://user:[email protected]:3128"
Environment="HTTPS_PROXY=https://user:[email protected]:3128"
Cảm ơn trước.
Tôi gặp vấn đề tương tự nhưng giải pháp của bạn không hiệu quả đối với tôi. Tôi có cntlm chạy thành công với Firefox, cài đặt proxy thành 127.0.0.1:3128. Nhưng không có vấn đề gì tôi cố gắng như IP với docker nó không hoạt động. Tôi đang sử dụng Windows 10. Tôi có 10.0.75.0 là Subnet Address và cho ipconfig/all tôi có 10.0.75.1. NPM sẽ không cài đặt bất cứ thứ gì. Bất kỳ ý tưởng? BTW: Nếu tôi chèn người dùng thông tin proxy: [email protected] nó hoạt động tốt. –