You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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)
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?)
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)
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.
Activity
dnephin commentedon Sep 1, 2015
I've been thinking about this, I think it's a good idea. I was considering naming the command
docker-compose configinstead ofvalidate.The default action would be:
With
-qdon't print the config, only errorsWith
--servicesonly print the service names (in correct dependency order), not the full config (replaces #1077)behemphi commentedon Sep 1, 2015
The command name is not terribly important to me, and
configmakes 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
aanand commentedon Sep 1, 2015
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.
dnephin commentedon Sep 1, 2015
Oh yes, I think these could definitely be merged. What do you think about naming (
servicevsconfig) ?aanand commentedon Sep 1, 2015
configmakes sense to me if (by default) it's going to output the full YAML.However, looking at #1498 again, the
--with-running-containerand--with-stopped-containercommands make it begin to feel like conflation. (One command to either print out YAML or list services that have a container running?)dnephin commentedon Sep 1, 2015
Ya, I agree with that.
--with-running-containerand--with-stopped-containerfeel a bit like they could be provided byps. 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 containersbehemphi commentedon Sep 2, 2015
$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.
psis 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.
[-]Feature Request: `validate` Command[/-][+]Feature Request: `docker-compose config` Command[/+]