Skip to content

Docker Configs

Docker Swarm configs are used to inject configuration files (like Nginx server blocks) into services without baking them into the image.

Configs are immutable — once created, they cannot be modified. To update a config, you must create a new one and update the service.

Terminal window
# List all configs
docker config ls
# Inspect a config
docker config inspect nginx_admin_conf --pretty
# Create a new config
docker config create nginx_newservice_conf ./newservice.conf
# Remove an old config (must not be in use by any service)
docker config rm nginx_oldservice_conf
  1. Create the updated config file
  2. Create a new Docker config with a versioned name: docker config create nginx_admin_conf_v2 admin.conf
  3. Update nginx.yml to reference nginx_admin_conf_v2
  4. Redeploy: docker stack deploy -c /home/kaks/stacks/nginx.yml dev
  5. Remove the old config: docker config rm nginx_admin_conf

All service credentials are defined as environment variables in the stack YAML files:

FileContains
/home/kaks/stacks/infrastructure.ymlDEV database passwords, RabbitMQ creds, Kafka settings
/home/kaks/stacks/services.ymlDEV app service env vars, Keycloak client secrets
/home/kaks/stacks/uat-infrastructure.ymlUAT database passwords, infra creds
/home/kaks/stacks/uat-services.ymlUAT app service env vars
/home/kaks/stacks/shared-infrastructure.ymlHarbor passwords, Nexus config

See Secrets & Credentials for a full list of credentials and where they live.