compose icon indicating copy to clipboard operation
compose copied to clipboard

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

Open cchung100m opened this issue 7 years ago • 9 comments

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

cchung100m avatar Jul 10 '19 03:07 cchung100m

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

ulyssessouza avatar Jul 10 '19 14:07 ulyssessouza

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

cchung100m avatar Jul 11 '19 05:07 cchung100m

Hi @ulyssessouza ,

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

cchung100m avatar Jul 11 '19 06:07 cchung100m

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

Thanks!!

Davidsouza20 avatar Aug 24 '19 02:08 Davidsouza20

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

romanKrds avatar Nov 15 '19 14:11 romanKrds

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

Aabhusan avatar Jan 13 '20 10:01 Aabhusan

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

nchejara avatar Feb 17 '20 10:02 nchejara

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

opub avatar Apr 15 '20 20:04 opub

Jup fixing quotations fixed it.

benbieler avatar May 04 '20 20:05 benbieler