Docker with salt - Issue with PIP

341 views
Skip to first unread message

Jon Langemak

unread,
Jul 7, 2015, 12:55:51 AM7/7/15
to salt-...@googlegroups.com
I started playing around with the docker modules for Salt on Centos7 and there were a couple of PIP modules that I needed or needed to update.  To do so, I use the following states...

docker-py:
  pkg.installed:
    - name: python-pip
  pip.installed:
    - name: docker-py
    - reload_modules: True
    - require:
      - pkg: python-pip
six:
  pip.installed:
    - reload_modules: True
    - upgrade: True
    - require:
      - pkg: python-pip

These work well, but it seems that I need to reload the salt-minion on the client before I can use any of my actual docker states.  I get these errors until I reload the salt-minion service...

Comment: State 'docker.pulled' was not found in SLS 'docker'

Any ideas why this is?

Thanks


Boris FELD

unread,
Jul 7, 2015, 3:54:22 AM7/7/15
to salt-...@googlegroups.com
Yes because the docker salt state was loaded before you installed the python requirements, you need to add reload_modules: True at the end of pip.installed: docker-py, see the documentation here: https://docs.saltstack.com/en/develop/ref/states/index.html#reloading-modules

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jon Langemak

unread,
Jul 7, 2015, 8:52:50 AM7/7/15
to salt-...@googlegroups.com
Im confused.  I already tell it to reload_modules on that state...

docker-py:
  pkg.installed:
    - name: python-pip
  pip.installed:
    - name: docker-py
    - reload_modules: True
    - require:
      - pkg: python-pip

What am I missing here?  What you say makes sense, but I think Im already doing it.  

Boris FELD

unread,
Jul 7, 2015, 9:13:15 AM7/7/15
to salt-...@googlegroups.com
Do the state using docker.pulled require pip: docker-py?

--

Jon Langemak

unread,
Jul 7, 2015, 10:00:34 AM7/7/15
to salt-...@googlegroups.com
Heres my entire state...

I tried changing the layout of the PIP stuff a bit since I thought you were indicating I was out of order.  

#Install base packages

bridge-utils:

  pkg.installed

net-tools:

  pkg.installed

device-mapper:

  pkg.latest


python-pip:

  pkg.installed


six:

  pip.installed:

    - reload_modules: True

    - upgrade: True

    - require:

      - pkg: python-pip


docker-py:

  pip.installed:

    - reload_modules: True

    - require:

      - pkg: python-pip


#Install docker, enable it, and run it

docker:

  pkg:

    - installed

  service:

    - running

    - enable: true


#Take care of firewalld

firewalld:

  service:

    - dead

    - enable: false



web_8080_image:

  docker.pulled:

    - name: jonlangemak/docker:web_container_8080


web_8080:

  docker.running:

    - container: web_8080

    - image: jonlangemak/docker:web_container_8080

    - ports:

      - "8080/tcp":

        HostIp: ""

        HostPort: "80"

Boris FELD

unread,
Jul 7, 2015, 10:05:33 AM7/7/15
to salt-...@googlegroups.com
I'm not sure but could you try to add reload_module: True to pkg.installed: docker? Maybe the docker client tries to connect to the daemon on import.

--

Jon Langemak

unread,
Jul 7, 2015, 10:07:26 AM7/7/15
to salt-...@googlegroups.com
Ok - I'll try that.  Any other tips on how to debug this?  Seems odd that the fix is to restart the salt-minion service.

Jon Langemak

unread,
Jul 7, 2015, 10:11:42 AM7/7/15
to salt-...@googlegroups.com
Yeah - That didnt help.  I feel like Im missing something simple here.

Boris FELD

unread,
Jul 15, 2015, 10:53:15 AM7/15/15
to salt-...@googlegroups.com
 Could you paste a run of this state in with the logging level at DEBUG?

Le mar. 7 juil. 2015 à 16:11, Jon Langemak <j...@interubernet.com> a écrit :
Yeah - That didnt help.  I feel like Im missing something simple here.

--

Love Nyberg

unread,
Jul 16, 2015, 3:56:14 AM7/16/15
to salt-...@googlegroups.com
I would break that up into multiple  state files having them include each other and setup require's.

Jon Langemak

unread,
Jul 16, 2015, 9:18:44 AM7/16/15
to salt-...@googlegroups.com
Boris - When you say debug level do you mean running the salt-master and minion in debug mode?  Then executing the state?  Or were you looking for a different debug?

Jon Langemak

unread,
Jul 16, 2015, 9:19:29 AM7/16/15
to salt-...@googlegroups.com
This is how I have it currently broken up...

#python-pip:

  pkg.installed


six:

  pip.installed:

    - reload_modules: True

    - upgrade: True

    - require:

      - pkg: python-pip


#docker-py:

  pip.installed:

    - reload_modules: True

    - require:

      - pkg: python-pip


#Install docker, enable it, and run it

docker:

  pkg:

    - installed

    - reload_modules: True

  service:

    - running

    - enable: true


Any suggestions you have would be appreciated.  Thanks!

Boris FELD

unread,
Jul 16, 2015, 9:33:00 AM7/16/15
to salt-...@googlegroups.com
Yes please, it's only the minion side that will be interesting

Jon Langemak

unread,
Jul 16, 2015, 9:46:16 AM7/16/15
to salt-...@googlegroups.com
Here it is - let me know what you think.  Thanks!

Boris FELD

unread,
Jul 16, 2015, 10:34:16 AM7/16/15
to salt-...@googlegroups.com
From what I can see on the log, docker-py install correctly and salt correctly tries to lazyload docker.pulled but fails to load it. Do you have multiple python version on your system, maybe the command used to install docker-py ("/usr/bin/pip2 install 'docker-py'") install it somewhere salt couldn't reach.

Le jeu. 16 juil. 2015 à 15:46, Jon Langemak <j...@interubernet.com> a écrit :
Here it is - let me know what you think.  Thanks!

--

Jon Langemak

unread,
Jul 20, 2015, 11:02:59 AM7/20/15
to salt-...@googlegroups.com
Thanks for looking at that.  Maybe Im missing something, but if its somewhere that salt cant reach how does reloading the salt client help?

Priya R

unread,
Aug 9, 2017, 10:39:33 AM8/9/17
to Salt-users
Hi Jon

I am having the same problem as you now in 2017. Were you able to solve your problem?

Thanks,
Priya
Reply all
Reply to author
Forward
0 new messages