Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compose does not support 'configs' configuration with v3.3 #5110

Closed
MrHash opened this issue Aug 16, 2017 · 23 comments
Closed

Compose does not support 'configs' configuration with v3.3 #5110

MrHash opened this issue Aug 16, 2017 · 23 comments

Comments

@MrHash
Copy link

MrHash commented Aug 16, 2017

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.

@shin-
Copy link

shin- commented Aug 16, 2017

What is your question?

@MrHash
Copy link
Author

MrHash commented Aug 16, 2017

According to the documentation this should be supported: https://docs.docker.com/compose/compose-file/#short-syntax

So what is the correct solution to using configs in docker-compose v3.3? I am unable to deploy a stack (or is it a swarm) without completely redesigning compose files and this is a massive headache compared to the functionality of the previous minor release.

@shin-
Copy link

shin- commented Aug 16, 2017

Configs are only used when you deploy on Swarm mode using docker stack deploy. Compose recognizes the option as valid, but does not use the section as it is a feature only available for Swarm mode services / stacks.

HTH

@MrHash
Copy link
Author

MrHash commented Aug 16, 2017

Does the same apply to secrets now?

@shin-
Copy link

shin- commented Aug 16, 2017

We went with a compromise for the secrets implementation, see #4994 for details.

@shin- shin- closed this as completed Aug 22, 2017
@grikdotnet
Copy link

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

@teodorescuserban
Copy link

I wish a compromise would also be taken for extends (see moby/moby#31101).

@3ynm
Copy link

3ynm commented Oct 6, 2017

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?

@shin-
Copy link

shin- commented Oct 6, 2017

@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.

@jacobsvante
Copy link

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

@Mobe91
Copy link

Mobe91 commented Nov 10, 2017

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.

@CarlQLange
Copy link

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

@mikepuglisi
Copy link

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.

@3ynm
Copy link

3ynm commented Jul 3, 2018

I don't agree on refusing to do what's right based on suppositions.

But if you're decided, come on, is that difficult to add a warning in docs?

@shin-
Copy link

shin- commented Jul 3, 2018

Thanks for the feedback! Feel free to submit a PR to the docs repo

@nwalters512
Copy link

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.

@blitzaxt
Copy link

blitzaxt commented Nov 2, 2018

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

@cjaoude
Copy link

cjaoude commented Dec 29, 2018

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. :/

@ruimaciel
Copy link

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.

@lironmo
Copy link

lironmo commented Nov 19, 2019

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)?

@mnpenner
Copy link

@lironmo I think you're SOL. You can use a volume but volumes don't support chmod/chown AFAICT so if your service is picky about that sort of thing then I don't know what you can do.

@StevenMapes
Copy link

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?

@slinstaedt
Copy link

As a workaround one can use docker-compose.override.yml to extend the docker-compose.yml bind mounting the config file (given it's available as local file) in the service's volume section. Still: No template-driver available though.

Simplified example:
docker-compose.override.yml

services:
  traefik:
    image: traefik:2.3
    configs:
      - source: traefik-dynamic
        target: /etc/traefik/dynamic.yml
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
configs:
  traefik-dynamic:
    file: ./dynamic.yml

docker-compose.override.yml

services:
  traefik:
    volumes:
      - ./dynamic.yml:/etc/traefik/dynamic.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests