compose: Compose does not support 'configs' configuration with v3.3

Docker version 17.07.0-ce-rc2, build 36ce605
docker-compose version 1.15.0, build e12f3b9

sample config

version: "3.3"
configs:
  config.yml:
    file: ../config/config.yml
services:
  php:
    image: php:7.1-fpm
    configs:
      - source: config.yml
        target: /configs/config.yml

returns WARNING: Some services (php) use the 'configs' key, which will be ignored. Compose does not support 'configs' configuration - use docker stack deploy to deploy to a swarm.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 23

Most upvoted comments

Looks like documentation is written in a science-fiction manner.

If configs aren’t supported by docker-compose then it would be nice if the docs made that quite clear. Currently, the compose file reference features an extensive section on configs that doesn’t mention anywhere that the feature is not supported by docker-compose. This means that Docker users who read the docs and decide to invest their time trying out this feature are confronted with a warning that the configs key will be ignored, and that actually “Compose does not support ‘configs’ configuration”, which is a tad frustrating.

the docs do not make clear that this is a swarm-only feature. would it be possible to add a line saying as such?

Also just hit this issue. It is not obvious to me why docker-compose supports secrets but not configs. Especially for running swarm stacks locally via compose it would be nice to support this.

This only confuses people. There’s no reason why docker-compose supports secrets but not configs, since both can be implemented the same way. At least are you accepting PR for this?

It makes no sense that configs are not supported for non-swarm uses. It’s a pain-in-the-hoo to make a Dockerfile just to pull in a config. 😕

I just fell down the same rabbit hole as everyone above ^^^

Would be nice if the docs indicated the “configs” option is only for swarm.

@shin- I don’t understand this. Can you please explain?

Just ran into this issue. It would be great to hear from maintainers as to why they’ve decided to make this choice; the referenced issue didn’t really elucidate anything.

@Hacktivista We don’t want to commit to continued support for configs once the feature starts diverging from secrets, so it’ll have to stay a Swarm-exclusive feature. Sorry.

This just makes the whole thing very confusing:

Defining and using configs in compose files

Both the docker compose and docker stack commands support defining configs in a compose file. See the Compose file reference for details.

https://docs.docker.com/v17.09/engine/swarm/configs/#defining-and-using-configs-in-compose-files

sorry for the late response, what is the proper way to use run time configuration( when run dockers local with docker-compose without swarm orchestration)?

Just hit this myself with two services where I need custom config files, one could get around by not using docker and installing the service globally as I will need it for other things but the other I can’t as I need to use that service with different configuration setting.

I’m still fairly new to using docker so I’m a little confused as to how to get around this other than ditching docker and running the services outside of containers with different config files as and when required, which feels wrong.

So re-reading the above is this a fair summary

  1. You can’t do this with docker-compose (non-swarm) so don’t both trying
  2. You need to build a customer DockerFile that uses your custom configuration file (however you do that) then use that image within your docker-compose YML file?