At Stark & Wayne we are concerned with the complete lifecycle of deployments and simple upgrade paths are an important ingredient to any long running system.

For users of the cf-containers-broker (a service broker that will let you run and bind services that live in docker containers) upgrading their services just got much simpler.
By running bin/update_all_containers all containers will be restarted with the latest version of the image and configuration specified in the service plans.

When consuming the cf-containers-broker via the cloudfoundry-community/docker-boshrelease there is now a job property that will trigger automatic updates to all containers everytime the job is redeployed. This feature is available as of v25 of the BOSH release.

How does it work?

Because the cf-containers-broker itself is stateless it uses the custom labels feature of Docker to add the plan_id and instance_id of the service as metadata when creating the container.

This allows it to map running containers to service plans for upating.

Caveats

Since this feature relies on the existence of labels on the container it will only work with services that have been started with the latest version of the cf-containers-broker.

Containers that were started with an older version of the broker will not be affected and continue running in the state they were originally configured.

To allow the broker to update pre-existing service instances run:

cf update-service <service-id>  

This will allow the broker to add the necessary labels while recreating the service.

This command will only work if the service is advertized in the catalog as planupdateable: true.