Compose: TypeError: '<' not supported between instances of 'Container' and 'Container' in ps

Created on 12 Mar 2019  路  6Comments  路  Source: docker/compose

Description of the issue

docker-compose ps -a fails with a type error when containers are running

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.24.0-rc1, build 0f3d4dda
docker-py version: 3.7.0
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018

Output of docker version

Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:47:20 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker-compose config

networks:
  docker_net: {}
services:
  mongodb:
    command: mongod --smallfiles --logpath=/dev/null
    environment:
      MONGO_DATA_DIR: /data/db
      MONGO_LOG_DIR: /dev/null
    image: mongo:3.4
    networks:
      docker_net: null
    ports:
    - published: 27017
      target: 27017
    volumes:
    - /home/void/Projects/mjp/data/db:/data/db:rw
  postgres:
    environment:
      POSTGRES_PASSWORD: password
    image: postgres:9.6
    ports:
    - published: 5432
      target: 5432
    volumes:
    - /home/void/Projects/mjp/data/pgdb:/var/lib/postgresql/data:rw
version: '3.2'

Steps to reproduce the issue

  1. Create a compose file:
version: '3.2'

services:

  mongodb:
    image: mongo:3.4
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/dev/null
    ports:
      - 27017:27017
    volumes:
      - ./data/db:/data/db
    networks:
      - docker_net
    command: mongod --smallfiles --logpath=/dev/null

  postgres:
    image: postgres:9.6
    environment:
      POSTGRES_PASSWORD: password
    ports:
      - 5432:5432
    volumes:
      - ./data/pgdb:/var/lib/postgresql/data

networks:
  docker_net:
  1. Run docker-compose up -d
  2. Run docker-compose ps -a

Observed result

Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 712, in ps
TypeError: '<' not supported between instances of 'Container' and 'Container'
[31723] Failed to execute script docker-compose

Expected result

      Name                     Command               State            Ports          
-------------------------------------------------------------------------------------
mjp_mongodb_1    docker-entrypoint.sh mongo ...   Up      0.0.0.0:27017->27017/tcp
mjp_postgres_1   docker-entrypoint.sh postgres    Up      0.0.0.0:5432->5432/tcp 

Most helpful comment

@ulyssessouza great thanks, will update once 1.25 is released.

All 6 comments

I'm experiencing the same issue with docker-compose version 1.24.0, build 0aa59064.

I'm also getting this error with the newest version of docker-compose and docker-ce.

ubuntu@ip-bleh:/opt/nop$ docker-compose version
docker-compose version 1.24.0, build 0aa59064
docker-py version: 3.7.2
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018

ubuntu@ip-bleh:/opt/nop$ docker version
Client:
 Version:           18.09.5
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        e8ff056
 Built:             Thu Apr 11 04:43:57 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.5
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       e8ff056
  Built:            Thu Apr 11 04:10:53 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Just got this error on docker-compose version 1.24.1, build 4667896b, which appears to be the release directly after this was marked fixed. On macOS 10.14.6.

Result:

$~/docker: docker-compose ps -a
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 712, in ps
TypeError: '<' not supported between instances of 'Container' and 'Container'
[47719] Failed to execute script docker-compose

Hello @cbornhoft. The correction is meat to be in 1.25.0-rc1 not in 1.24.1

@ulyssessouza great thanks, will update once 1.25 is released.

I changed the version: '3.2' to version: "3.2" and everything worked for me

Was this page helpful?
0 / 5 - 0 ratings