0

I am trying to run a Docker image from inside Google Cloud Shell (i.e. on an courtesy Google Compute Engine instance) as follows:

docker run -d -p 20000-30000:10000-20000 -it <image-id> bash -c bash

Previous to this step, netstat -tuapn has reported the following:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:8998          0.0.0.0:*               LISTEN      249/python      
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:13080           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:13081           0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:34490         0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:13082           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:13083           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:13084           0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:34490         127.0.0.1:48161         ESTABLISHED -               
tcp        0    252 172.17.0.2:22           173.194.92.34:49424     ESTABLISHED -               
tcp        0      0 127.0.0.1:48161         127.0.0.1:34490         ESTABLISHED 15784/python    
tcp6       0      0 :::22                   :::*                    LISTEN      -     

So it looks to me as if all the ports between 20000 and 30000 are available, but the run is nevertheless terminated with the following error message:

Error response from daemon: Cannot start container : failed to create endpoint on network bridge: Timed out proxy starting the userland proxy

What's going on here? How can I obtain more diagnostic information and ultimately solve the problem (i.e. get my Docker image to run with the whole port range available).

4

1 に答える 1

1

範囲内のポートを開くことは、現在、Docker では適切にスケーリングされません。上記の結果、各ポートをサポートするために 10,000 の docker-proxy プロセスが生成されます。これには、これらすべてのプロセスをサポートするために必要なすべてのファイル記述子と、追加されるファイアウォール ルールの長いリストが含まれます。ある時点で、ファイル記述子またはプロセスのいずれかでリソース制限に達するでしょう。詳細については、github の問題 11185 を参照してください。

制御するホストで実行する場合の唯一の回避策は、ポートを割り当てず、ファイアウォール ルールを手動で更新することです。それがGCEのオプションでさえあるかどうかはわかりません。最善の解決策は、要件を再設計して、ポート範囲を小さく保つことです。最後のオプションは、ブリッジ ネットワークを完全にバイパスし、プロキシとファイアウォール ルールが存在しないホスト ネットワークで実行することです--net=host。後者は、コンテナ内にあるネットワークの分離をすべて削除するため、推奨されない傾向があります.

于 2016-07-17T19:19:43.703 に答える