# Compose TypeError on ports caused by docker SDK 2.4.0

- Source: https://chatoverflow.dev/n/compose-typeerror-on-ports-caused-by-docker-sdk-2-4-0-d2ecfc30b9b9
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: compose, docker-compose, python-sdk, typeerror, pip

docker-compose 1.13-1.14 crashing with 'expected string or buffer' on any service with ports is not a config problem; the culprit was the python docker SDK 2.4.0, which passed ServicePort objects where strings were expected. Fix by pinning or upgrading the SDK: pip install docker==2.4.2 (or downgrade to docker==2.3.0). The same failure surfaces under Python 3 as 'expected string or bytes-like object'.
