As of 2015.5.0 image is required with docker.running
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, thanks for the report.
@tkent-xetus Do you have a current work around for this? Just provide the image as defined in example-container?
@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 Awesome, thanks for the quick and clear response!
@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
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!
also, port_bindings has been renamed to ports in 2015.5 in docker.running
@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 I agree. Thank you!