compose 1.26.0 breaks TLS verification logic

Created on 4 Jun 2020  路  6Comments  路  Source: docker/compose

Description of the issue

docker-compose 1.26.0 breaks TLS verification logic

Context information (for bug reports)

Output of docker-compose version

$ docker-compose version
docker-compose version 1.26.0, build unknown
docker-py version: 4.2.0
CPython version: 3.8.2
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

Output of docker version

Client:
 Version:           19.03.8
 API version:       1.38 (downgraded from 1.40)
 Go version:        go1.13.10
 Git commit:        afacb8b7f0d8d4f9d2a8e8736e9c993e672b41f3
 Built:             Fri May  1 15:37:13 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.3-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       d7080c1
  Built:            Tue Feb 19 23:07:53 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

$ docker-compose -f docker-compose-test.yaml config
services:
  alpine:
    image: alpine
version: '2.4'

Steps to reproduce the issue

  1. pip3 install --user docker-compose==1.26.0
  2. export DOCKER_HOST=tcp://172.17.0.1:2375/
  3. docker-compose -f docker-compose-test.yaml run alpine
  4. go back to docker-compose 1.25.5

    $ pip3 install --user docker-compose==1.25.5
    -- snip --
    
    $ docker-compose -f docker-compose-test.yaml run alpine
    Pulling alpine (alpine:)...
    latest: Pulling from library/alpine
    Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
    Status: Downloaded newer image for alpine:latest
    / #
    

Observed result

$ docker-compose -f docker-compose-test.yaml run alpine
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/main.py", line 72, in main
    command()
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/main.py", line 125, in perform_command
    project = project_from_options('.', options)
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/command.py", line 66, in project_from_options
    return get_project(
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/command.py", line 141, in get_project
    client = get_client(
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/docker_client.py", line 45, in get_client
    client = docker_client(
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/docker_client.py", line 141, in docker_client
    context = Context("compose", host=host, tls=verify)
TypeError: __init__() got an unexpected keyword argument 'tls'

Expected result

$ docker-compose -f docker-compose-test.yaml run alpine
Pulling alpine (alpine:)...
latest: Pulling from library/alpine
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for alpine:latest
/ # 

Stacktrace / full error message

$ docker-compose -f docker-compose-test.yaml run alpine
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/main.py", line 72, in main
    command()
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/main.py", line 125, in perform_command
    project = project_from_options('.', options)
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/command.py", line 66, in project_from_options
    return get_project(
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/command.py", line 141, in get_project
    client = get_client(
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/docker_client.py", line 45, in get_client
    client = docker_client(
  File "/home/user/.local/lib/python3.8/site-packages/compose/cli/docker_client.py", line 141, in docker_client
    context = Context("compose", host=host, tls=verify)
TypeError: __init__() got an unexpected keyword argument 'tls'

Additional information

installed via pip3 as shown above

kinbug

Most helpful comment

Cool!
I'll fix the setup.py to enforce docker>=4.2.1 as minimum required in case of installation through pip install. The fix should be there for 1.26.1

All 6 comments

I have the exact same error when using the docker-compose Ansible plugin since this morning, downgrading to version 1.25.5 solves my error.

Capture

@jumanjiman Could you please confirm if it still happens after running the following line?

$ pip3 install --user docker==4.2.1

next line solved an issue:
apk add --no-cache py-pip make bash docker-compose && pip install -U python-dotenv && pip3 install --user docker==4.2.1 && rm -rf /var/cache/apk/*

@jumanjiman Could you please confirm if it still happens after running the following line?

$ pip3 install --user docker==4.2.1

This ^^^ fixes it for me.

Cool!
I'll fix the setup.py to enforce docker>=4.2.1 as minimum required in case of installation through pip install. The fix should be there for 1.26.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

darkrasid picture darkrasid  路  3Comments

Hendrik-H picture Hendrik-H  路  3Comments

saulshanabrook picture saulshanabrook  路  3Comments

bitver picture bitver  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments