Skip to content

Feature Request: docker-compose config Command #1953

Closed

Description

@behemphi

It would be pretty nice to have a docker-compose validate command that would validate the structure of the YAML file. The specific use case I have in mind is for CI pipelines.

  • Return true if valid YAML of Docker-Compose format
  • Return false otherwise

Activity

  1. dnephin commented on Sep 1, 2015

    @dnephin

    I've been thinking about this, I think it's a good idea. I was considering naming the command docker-compose config instead of validate.

    The default action would be:

    • validate the config
    • on success print the config to stdout with variables interpolated and with extends merged in, and exit status 0
    • on failure print the error to stderr and exit status 1

    With -q don't print the config, only errors
    With --services only print the service names (in correct dependency order), not the full config (replaces #1077)

  2. behemphi commented on Sep 1, 2015

    @behemphi
    Author

    The command name is not terribly important to me, and config makes sense for sure.

    Your idea on the output is much better than my own. Helps with debugging at development time too that way.

    +1 for @dnephin

  3. aanand commented on Sep 1, 2015

    @aanand

    Yeah, this is a great idea. See also the featureset I sketched out in #1498, which would make shell completion much cleaner and less buggy.

  4. dnephin commented on Sep 1, 2015

    @dnephin

    Oh yes, I think these could definitely be merged. What do you think about naming (service vs config) ?

  5. aanand commented on Sep 1, 2015

    @aanand

    config makes sense to me if (by default) it's going to output the full YAML.

    However, looking at #1498 again, the --with-running-container and --with-stopped-container commands make it begin to feel like conflation. (One command to either print out YAML or list services that have a container running?)

  6. dnephin commented on Sep 1, 2015

    @dnephin

    Ya, I agree with that. --with-running-container and --with-stopped-container feel a bit like they could be provided by ps. The distinction I was running with was:

    • config - never hits the api, only deals with values from the config, prints config or parts of it (service names)
    • ps - hits the api, lists containers
  7. behemphi commented on Sep 2, 2015

    @behemphi
    Author

    $0.02

    My intent was around keeping a compose file in a project and having my CI system validate it. @dnephin suggestion extends that suggestion to help with the development.

    ps is an operational tool to tell me, as an ops person, what is running at any given time. I would exercise this in a "trusty but verify" situation, or when something is wrong (alert comes in) and I use the command to see if a service is down according to docker-compose.

    TL;DR

    I see these functions as orthogonal in purpose and intent.

  8. changed the title [-]Feature Request: `validate` Command[/-] [+]Feature Request: `docker-compose config` Command[/+] on Sep 11, 2015
  9. added this to the 1.6.0 milestone on Oct 19, 2015
  10. self-assigned this
    on Nov 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions