title: Poetry: Max retries exceeded with url in gitlab runner
body: <p>I have a simple <code>.gitlab-ci.yml</code> script that builds my python project.</p>
  <pre class="lang-yml prettyprint-override"><code>image: python:3.9.6-slim-buster
  variables:
      PIP_DEFAULT_TIMEOUT: 300
  before_script:
      - pip install poetry==1.1.7
      - poetry config virtualenvs.create false
      - poetry install
  </code></pre>
  <p>When I run the CI pipeline, I periodically get such errors and the job is interrupted with a failure.</p>
  <p>First type of error:</p>
  <pre><code>...
    • Installing toml (0.10.2)
    • Installing uvloop (0.16.0)
    • Installing watchgod (0.8.2)
    • Installing websockets (10.3)
    ConnectionError
    HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /pypi/flake8-eradicate/1.2.1/json (Caused by NewConnectionError('&lt;urllib3.connection.HTTPSConnection object at 0x7fa5c5625dc0&gt;: Failed to establish a new connection: [Errno -2] Name or service not known'))
    at /usr/local/lib/python3.9/site-packages/requests/adapters.py:565 in send
        561│             if isinstance(e.reason, _SSLError):
        562│                 # This branch is for urllib3 v1.22 and later.
        563│                 raise SSLError(e, request=request)
        564│ 
      → 565│             raise ConnectionError(e, request=request)
        566│ 
        567│         except ClosedPoolError as e:
        568│             raise ConnectionError(e, request=request)
        569│ 
  Cleaning up project directory and file based variables
  00:01
  ERROR: Job failed: exit code 1
  </code></pre>
  <p>Second type of error:</p>
  <pre><code>...
    • Installing gitpython (3.1.27)
    OSError
    Could not find a suitable TLS CA certificate bundle, invalid path: /usr/local/lib/python3.9/site-packages/certifi/cacert.pem
    at /usr/local/lib/python3.9/site-packages/requests/adapters.py:263 in cert_verify
        259│             if not cert_loc:
        260│                 cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)
        261│ 
        262│             if not cert_loc or not os.path.exists(cert_loc):
      → 263│                 raise OSError(
        264│                     f&quot;Could not find a suitable TLS CA certificate bundle, &quot;
        265│                     f&quot;invalid path: {cert_loc}&quot;
        266│                 )
        267│ 
  Cleaning up project directory and file based variables
  00:00
  ERROR: Job failed: exit code 1
  </code></pre>
  <p>What is most interesting is that these errors are triggered on <strong>completely different libraries at different times</strong>. I have to do a <strong>retry</strong> many times so that it installs everything stably. What could be the problem and how to solve it?</p>
  <p>For info: I use dockerized gitlab runner with docker executor on CentOS 7</p>