salt icon indicating copy to clipboard operation
salt copied to clipboard

As of 2015.5.0 image is required with docker.running

Open tkent-xetus opened this issue 11 years ago • 9 comments

Prior to salt 2015.5.0, image was not required for the docker.running state. So a state that looked like this worked just fine:

example-container-running:
  require:
    - docker: example-container-installed
  docker.running:
    - container: example-container

Now that same state will produce an error that image is required missing. This breaks backwards compatibility with the previous versions.

Ideally, if the container being started already exists (created from the docker.installed state, for example), the container's associated image is assumed.

tkent-xetus avatar May 12 '15 19:05 tkent-xetus

@tkent-xetus, thanks for the report.

jfindlay avatar May 13 '15 18:05 jfindlay

@tkent-xetus Do you have a current work around for this? Just provide the image as defined in example-container?

immunda avatar May 16 '15 19:05 immunda

@immunda Correct! If you specify the image key, your states will work - it's just a pain to update/test all your formulas.

So, to be clear, to work around the problem in the example I posted, one would use something like:

example-container-installed:
  docker.installed:
    - name: example-container
    - image: some/image

example-container-running:
  require:
    - docker: example-container-installed
  docker.running:
    - container: example-container
    - image: some/image

(A related warning though, if your images use a tag specifier do not use the tag key in the docker.installed or the docker.running states. They won't work properly if you do. You have to specify the tag as part of the image value in the traditional docker way of 'image/path:TAG'. That's another issue I need to find time to document)

tkent-xetus avatar May 16 '15 19:05 tkent-xetus

@tkent-xetus Awesome, thanks for the quick and clear response!

immunda avatar May 16 '15 19:05 immunda

@tkent-xetus I have a problem with this solution: https://gist.github.com/cmhe/3fd556c87bb2de9725d6

saltstack: 2015.5.0 docker: 1.6.2 docker-py: 0.5.3

Do you have an idea for a workaround for this workaround ;)

cmhe avatar Jun 16 '15 09:06 cmhe

@cmhe

Unfortunately, it looks like you're running into a different issue all together. It turns out that the entire dockerio module is pretty much a just wrapper that calls docker-py methods. Unfortunately, dockerio doesn't do any version checking of docker-py to detect supported/unsupported features, so you get errors like the one you posted. I know, because I ran into a lot of them :-).

Anyway, I took a peek at the 0.5.3 docker-py source and, sure enough, create_container doesn't support cpu_set in that version. It looks like it wasn't introduced until 0.6.0.

TL;DR This is an unrelated issue. If you upgrade to 0.6.0 (or later) of docker-py, it should work for ya, good luck!

tkent avatar Jun 16 '15 14:06 tkent

also, port_bindings has been renamed to ports in 2015.5 in docker.running

mpaolini avatar Jun 18 '15 06:06 mpaolini

@jfindlay

I think we should close this issue. The docker module/state support in salt has undergone some pretty large changes since this issue was written and it's no longer relevant.

tkent avatar Apr 20 '17 17:04 tkent

@tkent I agree. Thank you!

rallytime avatar Apr 20 '17 17:04 rallytime