@@ -94,6 +94,8 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
9494 flags .SetAnnotation (flagDNSSearchAdd , "version" , []string {"1.25" })
9595 flags .Var (& options .hosts , flagHostAdd , "Add a custom host-to-IP mapping (host:ip)" )
9696 flags .SetAnnotation (flagHostAdd , "version" , []string {"1.25" })
97+ flags .BoolVar (& options .init , flagInit , false , "Use an init inside each service container to forward signals and reap processes" )
98+ flags .SetAnnotation (flagInit , "version" , []string {"1.37" })
9799
98100 // Add needs parsing, Remove only needs the key
99101 flags .Var (newListOptsVar (), flagGenericResourcesRemove , "Remove a Generic resource" )
@@ -235,6 +237,11 @@ func runUpdate(dockerCli command.Cli, flags *pflag.FlagSet, options *serviceOpti
235237
236238// nolint: gocyclo
237239func updateService (ctx context.Context , apiClient client.NetworkAPIClient , flags * pflag.FlagSet , spec * swarm.ServiceSpec ) error {
240+ updateBool := func (flag string , field * bool ) {
241+ if flags .Changed (flag ) {
242+ * field , _ = flags .GetBool (flag )
243+ }
244+ }
238245 updateString := func (flag string , field * string ) {
239246 if flags .Changed (flag ) {
240247 * field , _ = flags .GetString (flag )
@@ -306,6 +313,7 @@ func updateService(ctx context.Context, apiClient client.NetworkAPIClient, flags
306313 updateString (flagWorkdir , & cspec .Dir )
307314 updateString (flagUser , & cspec .User )
308315 updateString (flagHostname , & cspec .Hostname )
316+ updateBool (flagInit , cspec .Init )
309317 if err := updateIsolation (flagIsolation , & cspec .Isolation ); err != nil {
310318 return err
311319 }
0 commit comments