-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Proposal: Config file for default command line options #7232
Comments
Probably that
And NOT this?
|
Yeah, it could do. The Like |
Few questions:
|
|
I like ideas that make it easier to work with docker and reduce the amount of typing required. Having said that, I don't think this proposal is really "there" (yet). I'll try to describe my thoughts and questions when reading this proposal;
In general;
Sorry if the comments are a bit disorganised - was writing them while overthinking the implications of this proposal. Hope they are useful anyhow 😄 |
I think if it's entirely client-side, that's just one more barrier for API-implementers, since then we'll see 14 different competing interpretations of parsing our "config" file spring up. |
I don't think we should merge cli and config. If you specify 1 or more On Friday, July 25, 2014, Sebastiaan van Stijn notifications@github.com
|
Combining config with command-line arguments may be troublesome in other cases as well. For example, if I specify a conflicting argument (config says |
@tianon would calling it |
I think sending it to the server would be, yeah, but it's not my call; I'm just an interested party here. :) |
@tianon so am I. Not technically-savvy enough to provide the code for such things, but try to give (hopefully useful) input where possible 😄 |
I also would like a But for image build and run defaults, I would really like to (also?) embed them into the Dockerfile and Image - its just as hidden from use as a What I was dreaming of originally, was to push the toml marshaling into a pflags wrapper, so the coder experience would be as it is today, and the defaulting would 'just happen'. This also gets hard when options can modify the defaults other options.. (which is a good reason to discard the defaults entirely when the user specifies some.) |
Thinking about this; what if someone specified But you do make a good point; I was thinking of Dockerfiles and/or examples distributed via GitHub, but people downloading an image from Docker Hub will only get the Image, no option to get additional data (read.me, Dockerrun). I like the idea of adding it to the Dockerfile, but it worries me that 'run-time' and 'build-time' settings are getting tangled up. |
I think the way git handles this is a great example; when you "git clone", |
@thaJeztah I agree with you that enabling options in a hidden config file is going to be surprising. I wonder why it isn't surprising with Git. Perhaps because it isn't often used and doesn't make large changes? You're right about the I think we should require you to specify the location of the config file, or at least require that you say you want to use it so there isn't surprising behaviour. |
DOCKER_CONFIG was introduced in moby#6984. We may use "config" for other purposes (e.g. moby#7232). Until we have made a design decision around how configuration files will work, DOCKER_CERT_PATH is a much safer name to rely on for future compatibility. Docker-DCO-1.1-Signed-off-by: Ben Firshman <ben@firshman.co.uk> (github: bfirsh)
@bfirsh and @vieux I was working on some pain points in the complicated SvenDowideit@39ed2b8 is the result. (plus I added IP and IPMask as they were needed in b2d-cli) If you like the direction I've taken it, I'll continue by adding tests for it. In Docker, we can then add some code to read the specified file, chop it up into the current command's section using the in Boot2Docker we do currently mix presets and cmdline, but we also don't have arrays of values... - but this can easily be changed. |
@SvenDowideit SGTM |
Docker Machine has a concept of an "active" machine, where we want the Docker client to be automatically configured to talk to that machine – i.e. having the We could use environment variables, but there's no neat way to do this without a manual step. These are the current instructions after creating a machine:
What I would quite like to do is to use a configuration file to set these options. I think the first version could just be the top-level Docker options in an ini-format file. For example in
The naming of the top-level key could do with some thought, but we can rename in the future without much pain. Ideas: One concern is automatically generating this file from Machine, which may overwrite a user-written file. I wonder if we need some kind of @shykes @crosbymichael @jfrazelle @vieux @thaJeztah @SvenDowideit @tianon @ehazlett thoughts? |
What if instead of overwriting from Machine we just parse and adjust the needed options? I think if they are using Machine they would expect it to be re-configured so we wouldn't have to worry about that specific value. |
Ideally I would expect Docker Machine to be able to manage multiple machines and be able to switch to a different machine just by usingDocker Machine, e.g. I don't think overwriting settings is necessary if the ini-file uses inheritance (example); [global]
host = unix:///var/run/docker.sock
auth = identity
[staging : global]
host = tcp://123.456.789
each machine can have its own config and inherit settings from the global configuration. |
@thaJeztah Machine already has a concept of an active machine and can switch between them. I don't think we don't want Docker to be aware of Machine. Instead we want Machine to be able to instruct Docker which host it should be talking to. Two reasons:
|
@bfirsh Yes, you're absolutely right; the actual "switching" should be handled by docker, machine should only instruct the docker-client which machine/host to use. wrt switching hosts (thinking out loud here); I can see this possibly conflicting with using swarm, i.e. if |
@thaJeztah Yes, that could be a problem. I think environment variables and the |
There's also the case of hosts that are not maintained/created by Swarm or Machine. If Docker only keeps track of the current host, then switching to another host will overwrite that information. Which brings us back to #7232 (comment) A possible solution would be to have Docker keep a list of host-configurations and allow switching between them. Machine, Swarm and other software would be able to add/update/remove a configuration in that list. But that overlaps a lot with the functionality that Machine offers (apart from not offering the actual creation and provisioning of new hosts). |
so is this compose? |
I think @bfirsh hijacked his own issue, describing a different use case starting from this #7232 (comment) I suggest to;
|
where are we on this? We have a config file that can be used to store additional (common) config properties (like DockerHost). I'm not sure we should use a "config file" for properties that specific to just one command though. The example specified in the original comment ( #7232 (comment) ) is odd to me - that feels more like using a text file to represent the cmd line flags - I would call that more like a compose yml than a config file. |
@bfirsh can we close this? |
I do agree with @duglin, I think we should close this one 😉 |
Ok I agree and I'll be the one that did it /o\ |
Docker needs a way of specifying options to "docker run" in a file.
You shouldn't have to write all this:
Instead, this could be in a file called
.docker/config
:Then you can just run
docker run
in the same directory as that file.This is a bit like how
.git/config
works, where you can, for example, specify options under a[log]
section that overrides options ongit log
.You could also specify what file to use with the
--config
option, like so:If you want to disable the config and specify options manually, there could be a
--no-config
option.Environment variables could be specified by using the
env-file
option.The text was updated successfully, but these errors were encountered: