diff --git a/command/service/create.go b/command/service/create.go index 59e838ca8f..d2925b42db 100644 --- a/command/service/create.go +++ b/command/service/create.go @@ -27,6 +27,8 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command { } flags := cmd.Flags() flags.StringVar(&opts.mode, flagMode, "replicated", "Service mode (replicated or global)") + flags.StringVar(&opts.name, flagName, "", "Service name") + addServiceFlags(cmd, opts) flags.VarP(&opts.labels, flagLabel, "l", "Service labels") diff --git a/command/service/opts.go b/command/service/opts.go index 87968fd1b4..5fdc56de05 100644 --- a/command/service/opts.go +++ b/command/service/opts.go @@ -511,7 +511,6 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) { // Any flags that are not common are added separately in the individual command func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) { flags := cmd.Flags() - flags.StringVar(&opts.name, flagName, "", "Service name") flags.StringVarP(&opts.workdir, flagWorkdir, "w", "", "Working directory inside the container") flags.StringVarP(&opts.user, flagUser, "u", "", "Username or UID (format: [:])") diff --git a/command/service/update.go b/command/service/update.go index 6034979a66..e1f7cad66b 100644 --- a/command/service/update.go +++ b/command/service/update.go @@ -172,7 +172,6 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error { return task.Resources } - updateString(flagName, &spec.Name) updateLabels(flags, &spec.Labels) updateContainerLabels(flags, &cspec.Labels) updateString("image", &cspec.Image)