diff --git a/components/engine/cmd/dockerd/config.go b/components/engine/cmd/dockerd/config.go index d462a8893d..87d8e1d48e 100644 --- a/components/engine/cmd/dockerd/config.go +++ b/components/engine/cmd/dockerd/config.go @@ -22,7 +22,11 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) { flags.Var(opts.NewNamedListOptsRef("exec-opts", &conf.ExecOptions, nil), "exec-opt", "Runtime execution options") flags.StringVarP(&conf.Pidfile, "pidfile", "p", defaultPidFile, "Path to use for daemon PID file") flags.StringVarP(&conf.Root, "graph", "g", defaultDataRoot, "Root of the Docker runtime") - flags.MarkDeprecated("graph", "Please use --data-root instead") + + // "--graph" is "soft-deprecated" in favor of "data-root". This flag was added + // before Docker 1.0, so won't be removed, only hidden, to discourage its usage. + flags.MarkHidden("graph") + flags.StringVar(&conf.Root, "data-root", defaultDataRoot, "Root directory of persistent Docker state") flags.BoolVarP(&conf.AutoRestart, "restart", "r", true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run") diff --git a/components/engine/cmd/dockerd/daemon.go b/components/engine/cmd/dockerd/daemon.go index cdc76f93b9..d4e9bd45e0 100644 --- a/components/engine/cmd/dockerd/daemon.go +++ b/components/engine/cmd/dockerd/daemon.go @@ -423,6 +423,10 @@ func loadDaemonCliConfig(opts daemonOptions) (*config.Config, error) { conf.CommonTLSOptions.KeyFile = opts.common.TLSOptions.KeyFile } + if flags.Changed("graph") && flags.Changed("data-root") { + return nil, fmt.Errorf(`cannot specify both "--graph" and "--data-root" option`) + } + if opts.configFile != "" { c, err := config.MergeDaemonConfigurations(conf, flags, opts.configFile) if err != nil { @@ -441,6 +445,10 @@ func loadDaemonCliConfig(opts daemonOptions) (*config.Config, error) { return nil, err } + if flags.Changed("graph") { + logrus.Warnf(`the "-g / --graph" flag is deprecated. Please use "--data-root" instead`) + } + // Labels of the docker engine used to allow multiple values associated with the same key. // This is deprecated in 1.13, and, be removed after 3 release cycles. // The following will check the conflict of labels, and report a warning for deprecation. diff --git a/components/engine/docs/deprecated.md b/components/engine/docs/deprecated.md index 509f1607f8..b57bbbecfe 100644 --- a/components/engine/docs/deprecated.md +++ b/components/engine/docs/deprecated.md @@ -22,15 +22,16 @@ see [Feature Deprecation Policy](https://docs.docker.com/engine/#feature-depreca ### `-g` and `--graph` flags on `dockerd` -**Deprecated In Release: v1.14.0** - -**Target For Removal In Release: v1.17** +**Deprecated In Release: v17.05.0** The `-g` or `--graph` flag for the `dockerd` or `docker daemon` command was used to indicate the directory in which to store persistent data and resource configuration and has been replaced with the more descriptive `--data-root` flag. +These flags were added before Docker 1.0, so will not be _removed_, only +_hidden_, to discourage their use. + ### Top-level network properties in NetworkSettings **Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**