Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] docker states are broken python issue #58920

Open
noelmcloughlin opened this issue Nov 11, 2020 · 9 comments
Open

[BUG] docker states are broken python issue #58920

noelmcloughlin opened this issue Nov 11, 2020 · 9 comments
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@noelmcloughlin
Copy link
Contributor

Description
Running local masterless minion on Centos7 (vagrant centos/7 image) and docker states are broken.

  1. Install Docker
  2. Check docker
[vagrant@localhost ~]$ sudo -s
[root@localhost vagrant]# rpm -qa | grep docker
docker-ce-cli-19.03.13-3.el7.x86_64
python-docker-pycreds-0.3.0-11.el7.noarch
python-docker-py-1.10.6-11.el7.noarch
docker-ce-19.03.13-3.el7.x86_64
  1. Run docker salt states = failure on CentOS7
          ID: docker-compose-ng-nginx-latest-present
    Function: docker_image.present
        Name: nginx
      Result: False
     Comment: State 'docker_image.present' was not found in SLS 'docker.compose.ng'
              Reason: 'docker_image' __virtual__ returned False: 'docker.version' is not available.
     Changes:
----------
          ID: docker-compose-ng-nginx-latest-running
    Function: docker_container.running
        Name: nginx-latest
      Result: False
     Comment: One or more requisite failed: docker.compose.ng.docker-compose-ng-nginx-latest-present
     Started: 09:40:37.223405
    Duration: 0.005 ms
     Changes:

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info).

Steps to Reproduce the behavior
(Include debug logs if possible and relevant)

Related to:
#47234
#54449

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
[vagrant@localhost ~]$ sudo salt-call --versions-report --local
Salt Version:
           Salt: 3002.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: 5.6.0
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.11.1
        libgit2: Not Installed
       M2Crypto: 0.35.2
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.8 (default, Apr  2 2020, 13:34:55)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 17.0.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4

System Versions:
           dist: centos 7 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-1127.el7.x86_64
         system: Linux
        version: CentOS Linux 7 Core

PASTE HERE

Additional context
Add any other context about the problem here.

@noelmcloughlin noelmcloughlin added the Bug broken, incorrect, or confusing behavior label Nov 11, 2020
@sagetherage sagetherage added needs-triage Aluminium Release Post Mg and Pre Si severity-high 2nd top severity, seen by most users, causes major problems and removed needs-triage labels Nov 11, 2020
@sagetherage sagetherage added this to the Aluminium milestone Nov 11, 2020
@noelmcloughlin
Copy link
Contributor Author

Only seen on Centos/7.
Maybe the solution is pip install docker but I prefer to use the system python-docker package(s).

@morsik
Copy link
Contributor

morsik commented Nov 12, 2020

I've had similar problem with Ansible lately.

This is not problem with SaltStack nor Ansible, but with python-docker-py which is very old and aims to support very old Docker.

You installed Docker CE from official Docker repository which makes it latest version which python-docker-py is incompatible with.

The only solution to this is to install latest docker python library which is what @noelmcloughlin suggested.

@noelmcloughlin
Copy link
Contributor Author

noelmcloughlin commented Nov 15, 2020

Thanks @morsik
BTW, I tried rpm -e python-docker-py && pip install docker but a fresh CentOS7 VM (without python-docker-py) was needed, and pip-installed the python library. docker states now working.

@garethgreenaway garethgreenaway removed their assignment Jan 11, 2021
@sagetherage sagetherage added severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around and removed severity-high 2nd top severity, seen by most users, causes major problems Aluminium Release Post Mg and Pre Si labels Feb 24, 2021
@sagetherage sagetherage modified the milestones: Aluminium, Approved Feb 24, 2021
@shubb30
Copy link

shubb30 commented Aug 31, 2022

It looks like this problem is again present with the new 6.0.0 version of the docker python package.

When 6.0.0 is installed on a host, any docker-related states error with

     Comment: State 'docker_image.present' was not found in SLS 'mystate.container'
              Reason: 'docker_image' __virtual__ returned False: 'docker.version' is not available.

When I back the docker python package back to 5.0.3, then the states work correctly.

The 6.0.0 package was released Aug 18, 2022.

@Obbi89
Copy link

Obbi89 commented Oct 24, 2022

Short input on the issue. It seems that docker.version_info is not defined anymore (>=6.0.0) and version info is now attached to docker.__version__ for the python docker module.
This seems to cause issues with the version detection. Cause None is always < min required docker module version.
There might be other api changes, too.

See docker/docker-py@cd2c35a#diff-bb2080f45d047774e54443130a720356017839471a935153b2305fc74667834d

@DaAwesomeP
Copy link
Contributor

This issue persists with onedir. I worked around it with:

salt pip install "docker>=5,<6"

It seems like there is frequently a game of catch-up with the Docker APIs. Maybe creating an interface to something like Docker Compose would reduce the number of breaking APIs. Docker Compose has standardized, schema-versioned config files. Possibly the exact container definitions would be moved away from salt but the activation of a Compose file might be less prone to breaking changes.

@ethanholz
Copy link

This issue persists with onedir. I worked around it with:

salt pip install "docker>=5,<6"

It seems like there is frequently a game of catch-up with the Docker APIs. Maybe creating an interface to something like Docker Compose would reduce the number of breaking APIs. Docker Compose has standardized, schema-versioned config files. Possibly the exact container definitions would be moved away from salt but the activation of a Compose file might be less prone to breaking changes.

Does not seem to me and the issue persists on a new salt minion install.

@epelc
Copy link
Contributor

epelc commented Jan 4, 2024

Is this still an issue in 2024 with docker version 7? Wondering if we can update states to remove <6

@DaAwesomeP
Copy link
Contributor

Note that this will be a continual/repeating issue possibly until #64299 and #64296 are solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

9 participants