Skip to content

Commit b56eb76

Browse files
alexkreidlervdemeester
authored andcommitted
Add --init option to docker service create
Signed-off-by: Timothy Higinbottom <[email protected]>
1 parent a8ee42a commit b56eb76

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

cli/command/service/create.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
5858
flags.SetAnnotation(flagDNSSearch, "version", []string{"1.25"})
5959
flags.Var(&opts.hosts, flagHost, "Set one or more custom host-to-IP mappings (host:ip)")
6060
flags.SetAnnotation(flagHost, "version", []string{"1.25"})
61+
flags.BoolVar(&opts.init, flagInit, false, "Use an init inside each service container to forward signals and reap processes")
62+
flags.SetAnnotation(flagInit, "version", []string{"1.30"})
6163

6264
flags.Var(cliopts.NewListOptsRef(&opts.resources.resGenericResources, ValidateSingleGenericResource), "generic-resource", "User defined resources")
6365
flags.SetAnnotation(flagHostAdd, "version", []string{"1.32"})

cli/command/service/opts.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ type serviceOptions struct {
480480
user string
481481
groups opts.ListOpts
482482
credentialSpec credentialSpecOpt
483+
init bool
483484
stopSignal string
484485
tty bool
485486
readOnly bool
@@ -624,6 +625,7 @@ func (options *serviceOptions) ToService(ctx context.Context, apiClient client.N
624625
TTY: options.tty,
625626
ReadOnly: options.readOnly,
626627
Mounts: options.mounts.Value(),
628+
Init: options.init,
627629
DNSConfig: &swarm.DNSConfig{
628630
Nameservers: options.dns.GetAll(),
629631
Search: options.dnsSearch.GetAll(),
@@ -875,6 +877,7 @@ const (
875877
flagRollbackMonitor = "rollback-monitor"
876878
flagRollbackOrder = "rollback-order"
877879
flagRollbackParallelism = "rollback-parallelism"
880+
flagInit = "init"
878881
flagStopGracePeriod = "stop-grace-period"
879882
flagStopSignal = "stop-signal"
880883
flagTTY = "tty"

vendor/github.com/docker/docker/api/types/swarm/container.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)