Troubleshooting a docker-compose upgrade
System and docker information (1) execute cat / etc/redhat-release:
CentOS Linux release 7.5.1804 (Core)
(2) execute docker-- version:
Docker version 17.09.0-ce, build afdb6d4
(3) execute docker-compose version:docker-compose version 1.23.2, build 1110ad0docker-py version: 3.7.0CPython version: 2.7.5OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017 event cause
Recently, due to the needs of the development classmate project, we need to upgrade the docker-compose version from 1.12.x to 1.21.x (version 21 or above, currently 1.23.2) ~
Operation procedure (1) upgrade pip and install docker-compose:pip install-- upgrade pippip install docker-compose==1.23.2
The following error occurred:
Cannot uninstall 'texttable'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Solution:
Enter the / usr/lib/python (your version number) / site-packages/ directory and delete the package directory directly:
Rm-rf texttable-*.egg-info
(2) install docker-compose by pip again
Pip install docker-compose==1.23.2
At this point, it is normal for us to use the docker-compose version command, but when we enter the docker-compose.yml file path and execute docker-compose up-d or docker-compose ps, the following error occurs:
Traceback (most recent call last): File "/ usr/bin/docker-compose", line 10, in sys.exit (main ()) File "/ usr/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main command () File "/ usr/lib/python2.7/site-packages/compose/cli/main.py", line 124, in perform_command project = project_from_options ('.', options)
Or report an error like this:
Traceback (most recent call last): File "/ usr/bin/docker-compose", line 6, in from compose.cli.main import main File "/ usr/lib/python2.7/site-packages/compose/cli/main.py", line 22, in from.. bundle import get_image_digests File "/ usr/lib/python2.7/site-packages/compose/bundle.py", line 13 In from .network import get_network_defs_for_service File "/ usr/lib/python2.7/site-packages/compose/network.py", line 9, in from docker.types import IPAMConfigImportError: cannot import name IPAMConfig
Or an error report like this:
Traceback (most recent call last): File "/ usr/bin/docker-compose", line 7, in from compose.cli.main import main File "/ usr/lib/python2.7/site-packages/compose/cli/main.py", line 17, in import dockerImportError: No module named docker
The end result is the same, that is, docker-compose cannot be used ~ ~
Here is a way to deal with the above problems
In order not to encounter the thorny error above, the correct upgrade posture is summarized as follows:
The main steps are as follows:
(1) use pip list | grep docker to view information about installed docker packages.
(2) uninstall the packages listed in step 1 manually, as follows:
Pip uninstall docker
Pip uninstall docker-compose
Pip uninstall docker-py
Pip uninstall docker-pycreds
Pip uninstall dockerpty
(3) install docker-compose:pip install docker-compose==1.23.2-I http://pypi.douban.com/simple/-- trusted-host pypi.douban.com#