botocore.exceptions.EndpointConnectionError dall'interno del contenitore Mac Docker

Recentemente ho iniziato ad get un EndpointConnectionError (dopo un lungo timeout) quando tenta di contattare DynamoDB da dentro un contenitore Docker in esecuzione su Mac. Lo stesso codice e l'impostazione hanno funzionato in precedenza.

Ecco alcuni esempi di codice:

>>> from boto3 import resource >>> r = resource('dynamodb') >>> table = r.Table('Users') >>> table.put_item(Item={'id':'987987'}) 

Il mio ~ / .aws / config:

 [default] output = json region = us-east-1 

Codice che sto utilizzando per ribuild e riavviare il contenitore (da Mac OS):

 #!/bin/sh docker-machine ssh default "docker ps | awk 'NR > 1 {print \$1}' | xargs --no-run-if-empty docker kill" docker build -t <image_name> . docker-machine ssh default "docker run -p 80:80 -v /var/datenight_secret:/var/www/.aws <image_name>" & 

stacktrace:

     Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.4/dist-packages/boto3/resources/factory.py", line 518, in do_action response = action(self, *args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/boto3/resources/action.py", line 83, in __call__ response = getattr(parent.meta.client, operation_name)(**params) File "/usr/local/lib/python3.4/dist-packages/botocore/client.py", line 258, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/lib/python3.4/dist-packages/botocore/client.py", line 537, in _make_api_call operation_model, request_dict) File "/usr/local/lib/python3.4/dist-packages/botocore/endpoint.py", line 117, in make_request return self._send_request(request_dict, operation_model) File "/usr/local/lib/python3.4/dist-packages/botocore/endpoint.py", line 146, in _send_request success_response, exception): File "/usr/local/lib/python3.4/dist-packages/botocore/endpoint.py", line 219, in _needs_retry caught_exception=caught_exception) File "/usr/local/lib/python3.4/dist-packages/botocore/hooks.py", line 227, in emit return self._emit(event_name, kwargs) File "/usr/local/lib/python3.4/dist-packages/botocore/hooks.py", line 210, in _emit response = handler(**kwargs) File "/usr/local/lib/python3.4/dist-packages/botocore/retryhandler.py", line 183, in __call__ if self._checker(attempts, response, caught_exception): File "/usr/local/lib/python3.4/dist-packages/botocore/retryhandler.py", line 251, in __call__ caught_exception) File "/usr/local/lib/python3.4/dist-packages/botocore/retryhandler.py", line 274, in _should_retry return self._checker(attempt_number, response, caught_exception) File "/usr/local/lib/python3.4/dist-packages/botocore/retryhandler.py", line 314, in __call__ caught_exception) File "/usr/local/lib/python3.4/dist-packages/botocore/retryhandler.py", line 223, in __call__ attempt_number, caught_exception) File "/usr/local/lib/python3.4/dist-packages/botocore/retryhandler.py", line 356, in _check_caught_exception raise caught_exception botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://dynamodb.us-east-1.amazonaws.com/" 

    Ho lo stesso comportmento (si blocca per molto tempo, poi la stessa stacktrace) quando provo a noi-est-2 o eu-west-1. Gli stessi file di configuration e credenziali funzionano bene su un host EC2 da us-est-1 o dal mio Mac OS.

    Sulla base di questa domanda ho assicurato che HTTP_PROXY e HTTPS_PROXY siano entrambi vuoti.

    La versione Python è Python 3.4.3.

    L'esecuzione docker-machine stop default; docker-machine start default docker-machine stop default; docker-machine start default risolto il problema. Quanto profondamente insoddisfacente – ho pensato che sarebbe stato un problema interessante che mi insegnerebbe qualcosa sulla networking.