deviantony / docker-elk

The Elastic stack (ELK) powered by Docker and Compose.
MIT License
17.37k stars 6.81k forks source link

Recommend `docker compose` in README to prevent TypeError #1017

Closed Jesper-Hustad closed 2 months ago

Jesper-Hustad commented 2 months ago

Problem description

The README says to use docker-compose but this causes the following error. Using docker compose fixes the issue.

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command
    project = project_from_options('.', options)
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options
    return get_project(
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project
    client = get_client(
  File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client
    client = docker_client(
  File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 124, in docker_client
    kwargs = kwargs_from_env(environment=environment, ssl_version=tls_version)
TypeError: kwargs_from_env() got an unexpected keyword argument 'ssl_version'

Extra information

Stack configuration

Vanilla, no changes

Docker setup

$ docker version

Client: Docker Engine - Community
 Version:           27.2.1
 API version:       1.47
 Go version:        go1.22.7
 Git commit:        9e34c9b
 Built:             Fri Sep  6 12:08:10 2024
 OS/Arch:           linux/amd64
 Context:           default
$ docker-compose version

Docker Compose version v2.29.2

Container logs

$ docker-compose logs

docker-compose version 1.29.2, build unknown
docker-py version: <module 'docker.version' from '/home/XXXX/.local/lib/python3.10/site-packages/docker/version.py'>
CPython version: 3.10.12
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
antoineco commented 2 months ago

I agree that we should retire references to Compose v1 at some point. However, Compose v1 is not the reason for your error message since we support it just fine.

It seems like you have 2 conflicting versions on one hand: docker-compose is v1, docker compose is v2 (ref). On the other hand, v1 is probably not installed properly, otherwise it wouldn't be referencing Python packages inside /home/XXXX/.local/lib/python3....

Feel free to remove the broken v1 from your host since you already migrated to v2.

antoineco commented 2 months ago

Additional note: Compose v1 was indeed broken by a change to the docker Python package: https://stackoverflow.com/a/77651191

Despite this know breaking change, the docker-compose Python package seems to no longer be maintained. Its last release was in 2021: https://pypi.org/project/docker-compose/#history

I'm going to remove all references to Compose v1 in docker-elk, thanks for bringing this to my attention!