Docker イメージのビルドはデスクトップで問題なく動作します。Node.js NPM 依存関係のインストールは通常どおりに機能します。ただし、企業のプロキシの背後でホストされている Jenkins などの継続的統合サーバーを使用すると、Docker イメージのビルドは失敗します。
Node.js NPM の依存関係
Node.js パッケージのビルド中に、GIT 依存関係のクローン作成中に GIT に接続できない場合、コマンドnpm installが失敗します。
e1ce5e8407d1: Already exists
Status: Image is up to date for node:0.10.33
---> e1ce5e8407d1
Step 1 : RUN mkdir -p /usr/src/app
---> Using cache
---> 965cad0c68b0
Step 2 : WORKDIR /usr/src/app
---> Using cache
---> 4c498f0c07e9
Step 3 : COPY package.json /usr/src/app/
---> b0662a8275fb
Removing intermediate container 5aca20551452
Step 4 : RUN npm install
---> Running in 7ccf9e5362af
npm WARN package.json newww@2.0.0 No README data
npm WARN package.json Dependency 'async-cache' exists in both dependencies and devDependencies, using 'async-cache@^0.1.5' from dependencies
npm ERR! git clone https://github.com/npm/npm2es.git Cloning into bare repository '/root/.npm/_git-remotes/https-github-com-npm-npm2es-git-60a75edb'...
npm ERR! git clone https://github.com/npm/npm2es.git fatal: unable to access 'https://github.com/npm/npm2es.git/': Failed to connect to github.com port 443: Connection timed out
依存関係のある Java Maven、Ruby、Go Docker イメージ
Java、Ruby、または Go コンテナーを構築するときにも同じことが起こります。依存関係は、企業のプロキシ サーバー全体のリポジトリ サーバーに配置されます。
HTTP_PROXY 環境変数を使用して Docker を構成できることを知っていますが、Docker を適切に構成して CI 環境でイメージを適切に構築するにはどうすればよいでしょうか?