X Tutup
Skip to content

Deprecate --graph flag; Replace with --data-root#28696

Merged
vdemeester merged 2 commits intomoby:masterfrom
jlhawn:deprecate_graph_flag
Mar 31, 2017
Merged

Deprecate --graph flag; Replace with --data-root#28696
vdemeester merged 2 commits intomoby:masterfrom
jlhawn:deprecate_graph_flag

Conversation

@jlhawn
Copy link
Contributor

@jlhawn jlhawn commented Nov 22, 2016

This patch deprecates the -g or --graph flag on the dockerd or docker daemon command in favor of the more descriptive --data-root flag.

The name "graph" is a legacy term from long ago when there used to be a directory at the default location /var/lib/docker/graph. However, the flag would indicate the path of the parent directory of the "graph" directory which contains not only image data but also data for volumes, containers, and networks. In the most recent version of docker, this directory also contains swarm cluster state and node certificates.

Documentation for the --graph option has been updated to use the --data-root flag instead. A deprecation notice has also been added.

@shykes
Copy link
Contributor

shykes commented Nov 22, 2016

As the guy who first used the term "graph" in this context (because of the git-like graph relationship between layers), I agree that it's confusing and should be deprecated.

As long as this introduces absolutely no interface regression, I am in favor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma is missing

@jlhawn jlhawn force-pushed the deprecate_graph_flag branch 3 times, most recently from 44ed340 to db2f932 Compare November 22, 2016 07:07
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyperlink wrong: v1.11.0->v1.14.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to set it to a non-existing link?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just remove the link for now.

@jlhawn jlhawn force-pushed the deprecate_graph_flag branch from db2f932 to 6f6b107 Compare November 22, 2016 07:13
@AkihiroSuda
Copy link
Member

According to the docs include in this PR, the milestone of this PR seems 1.14.

However, in 1.13, GraphDriver plugin will be moved to out of experimental.
So, we need to decide whether we rename GraphDriver as well or not.
#28623

I'm +1 for renaming GraphDriver, but I don't think we should call it "DataRootDriver"...
Perhaps --storage-driver and "StorageDriver"?

PTAL @cpuguy83

@jlhawn
Copy link
Contributor Author

jlhawn commented Nov 22, 2016

So, we need to decide whether we rename GraphDriver as well or not.

Oh, I've been wanting to do that for about 2 years: #9758 but we never got around to doing it. There is also already an existing --storage-driver flag for dockerd:

  -s, --storage-driver string                 Storage driver to use

I'm +1 for renaming GraphDriver, but I don't think we should call it "DataRootDriver"...
Perhaps --storage-driver and "StorageDriver"?

I think these are two distinct things: --data-root just specifies where the directory is. Your choice of copy-on-write image/container filesystem storage driver is independent of that. The same directory will contain subdirectories for containers, image, network, swarm, tmp, volumes, and whatever the name of the storage driver is that you choose.

@vdemeester vdemeester added this to the 1.14.0 milestone Nov 22, 2016
@thaJeztah
Copy link
Member

@AkihiroSuda @jlhawn it was attempted twice; #22228 and #23237, but there were issues on Windows. Maybe they are resolved in the newer Windows versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add -d as a third choice here .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, would -d become confusing with -D? Otherwise I suggest to skip adding a shorthand flag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds reasonable. There's also not a shorthand for the --exec-root option. Let me know when the maintainers have a consensus on what to do here and I'll update if needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to remove it initially, it's easier to add later than to deprecate / remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, removed for now. I'll add it back if needed.

@jlhawn jlhawn force-pushed the deprecate_graph_flag branch 2 times, most recently from ba528be to 5120b0a Compare November 22, 2016 21:05
@estesp
Copy link
Contributor

estesp commented Nov 28, 2016

SGTM

@cpuguy83
Copy link
Member

Ok for me, but I don't think we could ever actually remove --graph/-g

@jlhawn jlhawn force-pushed the deprecate_graph_flag branch from 5120b0a to 490e870 Compare December 21, 2016 21:37
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️!

@thaJeztah
Copy link
Member

@jlhawn can you keep the old flags around as a hidden flag, in addition to the current one?

Also, the daemon.json should probably support the old name as well (but we can issue a warning, and deprecated that, so you need to add that to the deprecated.md)

@jlhawn
Copy link
Contributor Author

jlhawn commented Jan 19, 2017

can you keep the old flags around as a hidden flag, in addition to the current one?
Also, the daemon.json should probably support the old name as well (but we can issue a warning, and deprecated that, so you need to add that to the deprecated.md)

Is this not already covered by this: https://github.com/docker/docker/pull/28696/files#diff-a348195a1b645d5b477946b1efae728bR173 ? Also the graph option in the config file corresponds to the command line option so you should get a warning for that as well right?

@LK4D4
Copy link
Contributor

LK4D4 commented Jan 30, 2017

ping @thaJeztah

@thaJeztah
Copy link
Member

@jlhawn sorry, yes, you're right about the hidden flag. w.r.t. removing the flag, given that this flag has been around since docker < 1.0, we may need to decide to keep it around, and not actually remove it, but open to suggestions there.

There's a think that needs to be addressed in this PR; you forgot to update the name in the daemon.json file; https://github.com/docker/docker/blob/d6be0e98027611cfb14a3246ca797bee0936e649/daemon/config.go#L99

To allow both the old and the new name to work; possibly we need to have an additional property, that's mapped to the old (graph) name in the daemon.json. If a user uses that option, a deprecation warning should be printed.

In addition; the deprecation warning is currently printed on the commandline. Given that daemon options would usually be set in either a systemd unit file, or through daemon.json, I think we should actually log the error, otherwise people will never see the deprecation message

@jlhawn
Copy link
Contributor Author

jlhawn commented Jan 31, 2017

@thaJeztah I can't quite wrap my head around the code which handles the config file and command line arguments (theres a bunch of stuff which handles resolving conflicts and setting defaults when both are used). Is there an existing example of how to deprecate something from the config file? The only other daemon flag I see which is marked as deprecated is the --restart flag which doesn't have a corresponding config file JSON tag.

I think we should actually log the error, otherwise people will never see the deprecation message

The flag library being used will print the deprecation warning to stderr. What is different about manually logging it (besides the formatting)?

@jlhawn
Copy link
Contributor Author

jlhawn commented Jan 31, 2017

The more I look at it, the more it looks like I might have to "invent" a way of marking and handling deprecated config file options.

@thaJeztah
Copy link
Member

thaJeztah commented Jan 31, 2017

Yes, I think this is a first for config-file deprecation. It will probably mean something like;

type CommonConfig struct {
	RootDeprecated     string              `json:"graph,omitempty"`
	Root               string              `json:"data-dir,omitempty"`
}
  • if the "old" (graph) is set; print deprecation warning
  • if both "old" and "new" are set; produce error and fail

w.r.t. both "flag" and "config file"; the current behavior is that if both a flag and the same option in the config file are set, that an error is shown.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with I'll add it as a warning to the logs as well. from @thaJeztah 👼

@thaJeztah thaJeztah dismissed their stale review March 30, 2017 10:06

addressed

@thaJeztah thaJeztah force-pushed the deprecate_graph_flag branch from dc88a83 to 4df689c Compare March 30, 2017 10:19
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the deprecate_graph_flag branch from 4df689c to df7a72c Compare March 30, 2017 10:21
@thaJeztah
Copy link
Member

ok, updated after discussing with @vdemeester, and changed to hide the flag instead of printing a deprecation warning, and only log the warning. I think this is the least disruptive approach, and still discourages using the old flag, but happy to change back if we think otherwise

@thaJeztah
Copy link
Member

ok, discussed in the maintainers meeting, and there were no objections to this approach, so should be ready to go 😄

@vdemeester
Copy link
Member

Ok then, let's be crazy and merge it 👼

@vdemeester vdemeester merged commit 1ecaed0 into moby:master Mar 31, 2017
@thaJeztah
Copy link
Member

Thanks @jlhawn !

@alexellis
Copy link
Contributor

Although deprecated - is this a breaking change? There are lots of tutorials etc on the internet that advise on using -g to specify a different path/disk for the Docker data area.

@vdemeester
Copy link
Member

@alexellis the flags are hidden not removed. It won't break anyone.

These flags were added before Docker 1.0, so will not be removed, only
hidden, to discourage their use.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

X Tutup