Wednesday, February 7, 2024

[SOLVED] docker-compose doesn't run on CentOS 7

Issue

Running the docker-compose -f docker/common/docker-compose.yml up I get the error:

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 5, in <module>
    from compose.cli.main import main
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 18, in <module>
    import docker.errors
  File "/usr/lib/python2.7/site-packages/docker/__init__.py", line 2, in <module>
    from .api import APIClient
  File "/usr/lib/python2.7/site-packages/docker/api/__init__.py", line 2, in <module>
    from .client import APIClient
  File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 5, in <module>
    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/usr/lib/python2.7/site-packages/urllib3/__init__.py", line 10, in <module>
    from .connectionpool import (
  File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 31, in <module>
    from .connection import (
  File "/usr/lib/python2.7/site-packages/urllib3/connection.py", line 45, in <module>
    from .util.ssl_ import (
  File "/usr/lib/python2.7/site-packages/urllib3/util/__init__.py", line 4, in <module>
    from .request import make_headers

The Python version: Python 2.7.5

The above command used to work just fine before the latest system updates.


UPDATE

Upgrading Python to 3.x then upgrading docker-compose to the latest version solved this issue.


Solution

docker Compose project for python 2.7 has End of life .

please update to you system python to 3.X and install latest version of docker compose



Answered By - techgeek_parthi
Answer Checked By - Willingham (WPSolving Volunteer)