What if my application has a minimum docker version requirement?

We are using rancher for a while in our dev and staging environments so far.
We have been adding docker hosts to the rancher environments as we needed them.
After some time we have an heterogeneous docker hosts farm, some hosts on docker engine 1.6.2 some on 1.7.x and some on 1.8 … and so on.

Now when we launch a Stack into an environment we are not certainly sure it will work as expected since some docker-compose features are only available on certain docker engine versions. There is no way as far as I know, to specify minimum docker engine version requirement in a docker-compose.yml file.

Here my questions:

How can we specify that a stack needs at least docker engine version X? So that Rancher will only deploy on those hosts that meets those requirements? Is this covered by the affinity rules? I don’t find these options in http://docs.rancher.com/rancher/rancher-compose/scheduling/

Or must we always make sure that all the hosts are with the latest docker engine version?
This means that we must have upgrade docker engines on hosts very often. This requires that all the stacks are deployed in HA mode (lb+multihost for both app and db backends), so to avoid downtime.

thanks

We recently added host labels in Rancher 0.46.0 that have what you are looking for:

io.rancher.host.linux_kernel_version
io.rancher.host.docker_version

We are not documenting them yet because the affinity rules don’t support comparisons except for == and != Since it would be nice to say >=1.7 or something to that effect. So for now you could either whitelist or blacklist docker/kernel versions with affinity rules…

io.rancher.scheduler.affinity:host_label_ne: io.rancher.host.docker_version=1.6

You would need a rule per version you wanted to exclude. Or, if you always want the latest, you could use the host_label: io.rancher.host.docker_version=1.9 and just move that as releases roll out.

1 Like

@cloudnautique thanks that will just work fine for now.