Repository navigation
Closed
Labels
Milestone
Description
Description
Attempting to make use of docker_image.present fails.
Getting error message below:
ID: create docker images
Function: docker_image.present
Result: False
Comment: State 'docker_image.present' was not found in SLS 'prometheus/prometheus'
Reason: 'docker_image' __virtual__ returned False: 'docker.version' is not available.
Changes:
Setup
Running on ubuntu 20.04 server. Docker and docker python are installed like follows:
- on-prem machine
- VM (Virtualbox, KVM, etc. please specify)
- VM running on a cloud service, please be explicit and add details
- container (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
Steps to Reproduce the behavior
To install docker and pip.install the docker:
# Install docker
apt-transport-https:
pkg.installed: []
docker_repository:
pkgrepo.managed:
- name: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
- file: /etc/apt/sources.list.d/docker.list
- key_url: https://download.docker.com/linux/ubuntu/gpg
- require:
- pkg: apt-transport-https
- require_in:
- pkg: docker
docker:
pkg.installed:
- pkgs: [docker-ce, docker-compose-plugin]
service.running:
- name: docker
- enable: true
- reload: true
pip.installed:
- pkgs:
- "docker"
restart_service:
service.running:
- name: salt-minion
- enable: True
- watch:
- pip: docker
Then, running docker_image.present:
create docker images:
docker_image.present:
- build: /root/test_docker
- tag: prom_tester
- force: true
Expected behavior
The command works, instead we get errors
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.)Salt Version:
Salt: 3005
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: 6.0.0
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.1.0
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.10 (default, Jun 22 2022, 20:18:18)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-125-generic
system: Linux
version: Ubuntu 20.04 focal```
</details>
**Additional context**
I've tried restarting salt manually, tried reinstalling docker via pip, no success.
Activity
welcome commentedon Sep 1, 2022
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!
OrangeDog commentedon Sep 1, 2022
Possibly docker-py 6 has a breaking change not accounted for. If you install an earlier version does it then work?
ccottam commentedon Sep 1, 2022
I've hit the same issue, reverting the docker python module seems to offer a temporary fix
salt '' pip.install docker==5.0.3so an issue with docker-py 6.0.0 seems likely
Maxtaager commentedon Sep 1, 2022
It is, i also was surprised by this: 6.0.0 moved the version function so downgrading to 5.x works.
mohaldu commentedon Sep 5, 2022
Hi all, seems like downgrading to 5.x does work. I'm running into the same issue with salt's dockercompose, anyone know what version works? I've tried downgrading that a few versions now with no luck. Similar error with virtual returning false.
thrashwerk commentedon Oct 18, 2022
Same issue here. It works when downgrading to 5.0.3.
The question is why doesn't the onedir installation have the correct (or any) version of docker included which is what it's supposed to do according to documenation or why don't the docs mention actually supported versions?
https://docs.saltproject.io/en/latest/ref/states/all/salt.states.docker_container.html#module-salt.states.docker_container mentions that "all" docker versions are supported but that is simply not true and it would be wrong to assume that since it worked with 5.x it will work with 6.x or 7.x. That's why we there are these version numbers so you can expect breaking changes especially in major versions.
dariosusman commentedon Nov 1, 2022
If tests are needed, please let me know as I've got a testing environment for this.
I also refer to this: #54449
max-arnold commentedon Nov 3, 2022
This issue was fixed in #62882 and can be closed
fs30000 commentedon Dec 17, 2022
Getting this error as well. Using salt-ssh - 3005.1 to have a container running on Centos 7 host.
Docker rpm version : docker-1.13.1-209.git7d71120.el7.centos.x86_64
chateaulav commentedon Jul 18, 2023
Getting same error running as a state, and unable to gather correct dependency version tree for fix.
System is Ubuntu 22.04, Salt 3005.1
SLS Snippet:
lancachenet_dns: docker_container.running: - name: lancache-dns - image: lancachenet/lancache-dns:latest - restart_policy: unless-stoppedOutput Snippet:
docker versions on minion:
Salt Version:
Salt: 3005.1
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.0
libgit2: 1.6.4
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.9.8
pygit2: 1.12.2
Python: 3.9.16 (main, Jan 6 2023, 22:50:07)
python-gnupg: 0.4.8
PyYAML: 5.4.1
PyZMQ: 23.2.0
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: ubuntu 22.04 jammy
locale: utf-8
machine: x86_64
release: 5.15.0-76-generic
system: Linux
version: Ubuntu 22.04 jammy
Update
did clean install on minion, and pinned
docker 5.0.3state was able to run successfullyzyxep commentedon Jul 18, 2023
they do write the fix was merged into 3006.
stigok commentedon Mar 22, 2024
For those who are stuck on Salt version 3005.x for some reason, a work-around is applying the same kind of patch as Salt has done themselves, just in the docker-py package itself.
On the servers where you have this problem:
# salt-pip install -U docker/opt/saltstack/salt/pypath/lib/python3.9/site-packages/docker/__init__.py, by adding the following line:# salt-call docker.version