Automating Docker Swarm configs with Ansible

Introduction Docker Configs are a feature of Docker Swarm, that allow for the storing of non-sensitive information in a Docker Swarm cluster. They’re an alternative to bind mounts and environment variables. One of their main characteristics is that they’re immutable. That means that once they’re created, they can’t be updated. $ echo "This is my first config" | docker config create my-config - 3ysbxl9oq39qteo1wd57o3ttx $ echo "This is my second config" | docker config create my-config - Error response from daemon: rpc error: code = AlreadyExists desc = config my-config already exists While this is desirable when it comes to making sure all replicas are running with the same configuration, it makes it more difficult to rotate the configurations of a running service....

2021-12-04 · 6 min · Alexandre Bruyant