Compose: Failed to execute script docker-compose: TypeError: '<' not supported between instances of 'str' and 'int'

Created on 10 Jul 2019  路  9Comments  路  Source: docker/compose

Dear experts,

I am a newbie to the Docker technologies and trying to practice the docker-compose, however, I encounter the following error message when I am restarting the docker-compose, I would appreciate if you can point me how to solve this situation, thanks.

root@localhost:~# docker-compose restart
Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 124, in perform_command
  File "compose/cli/command.py", line 42, in project_from_options
  File "compose/cli/command.py", line 115, in get_project
  File "compose/config/config.py", line 385, in load
  File "compose/config/config.py", line 385, in <listcomp>
  File "compose/config/config.py", line 518, in process_config_file
  File "compose/config/config.py", line 226, in get_service_dicts
  File "distutils/version.py", line 46, in __eq__
  File "distutils/version.py", line 337, in _cmp
TypeError: '<' not supported between instances of 'str' and 'int'
[864] Failed to execute script docker-compose

My environment:

root@localhost:~# docker version
Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        2d0083d
 Built:             Thu Jun 27 17:57:09 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       2d0083d
  Built:            Thu Jun 27 17:23:02 2019
  OS/Arch:          linux/amd64
  Experimental:     false

root@localhost:~# docker-compose version
docker-compose version 1.23.1, build b02f1306
docker-py version: 3.5.0
CPython version: 3.6.7
OpenSSL version: OpenSSL 1.1.0f  25 May 2017

root@localhost:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.8 (stretch)
Release:    9.8
Codename:   stretch

Most helpful comment

What was wrong in you docker-compose.yml maybe help others with the same issue.

Thanks!!

All 9 comments

@cchung100m Could you please post the output of docker-compose config and steps to reproduce?

Hi @ulyssessouza

Thanks for the reply.

After installation of docker, I just type the command and get the errors, so that, there are no other steps to reproduce the issue.

root@localhost:~# docker-compose config
Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 121, in perform_command
  File "compose/cli/main.py", line 339, in config
  File "compose/cli/command.py", line 70, in get_config_from_options
  File "compose/config/config.py", line 385, in load
  File "compose/config/config.py", line 385, in <listcomp>
  File "compose/config/config.py", line 518, in process_config_file
  File "compose/config/config.py", line 226, in get_service_dicts
  File "distutils/version.py", line 46, in __eq__
  File "distutils/version.py", line 337, in _cmp
TypeError: '<' not supported between instances of 'str' and 'int'
[23503] Failed to execute script docker-compose

Hi @ulyssessouza ,

I found this issue comes from my misconfiguration of docker-compose.yml and I solved it, thank you for your time. :)

What was wrong in you docker-compose.yml maybe help others with the same issue.

Thanks!!

Mine was wrong due to the copy-paste. Wrong quotation marks, that's it =)

@cchung100m
what was the issue can your docker-compose.yml file please help me asap .

I got the same error because of the version property in docker-compose file defined dynamically.
It was like: version: '${DOCKER_VERSION}' and it's working fine when I changed to like: version: '3'

Just share in case someone did the same mistake like me

I ran into the same error when my version line was missing a quote.
version: 3'

Jup fixing quotations fixed it.

Was this page helpful?
0 / 5 - 0 ratings