Docker Community Forums

Share and learn in the Docker community.

Dynamic configuration of containers with UCP

(Datacarl) #1


What’s the recommended way to configure containers when running UCP? UCP obviously supports environment variables but our applications require setting files. I don’t really want to use volumes for config, but even if I did I cannot create the config file on the volume in UCP (unless I spawn a container, map it to the volume, use the console to edit a file on the volume etc etc). It seems like using a key value store like etcd or consul gives the most flexibility but there is no way to edit keys from UCP. I might be answering my own question here but it seems to only solution is to run my own key value store, edit the keys separately and have the containers load them, maybe based on an environment variable like ENV=production that I can set in UCP or pass to the container directly?

I’m tempted to use the etcd that UCP is using, but cannot find anything about that being a good idea so I’m assuming it’s considered private.

Thanks in advance for any input.

(Vivek Saraswat) #2

Can confirm that we recommend NOT using UCP’s k-v store for application containers =)

There are several different ways to do this; without volumes, running your own key-value store might be the best bet for your current deployment. You could use another instance of etcd for this purpose, or any other distributed kv store.

(Datacarl) #3

Thanks for confirming that Vivek!

Ended up with consul and consul-template for configuration. Apparently the recommended way to use consul is one deployment per environment, so all I do is pass the IP/hostname to the consul (for the environment I want to deploy) to the container and it looks up all the variables when it starts. Works fine but would be cool to be able to do it from UCP.

(Alm. Brand Docker admins) #4

If the Consul address is read by the container from an ENV instruction, you can just specify that in UCP when you launch the container. That’s more or less what we do :slight_smile:

(Datacarl) #5

Thanks, that’s exactly what I ended up doing. Very easy to reuse between different environments.