Add --read-only for service create and service update
This fix tries to address the issue raised in 29972 where it was not possible to specify `--read-only` for `docker service create` and `docker service update`, in order to have the container's root file system to be read only. This fix adds `--read-only` and update the `ReadonlyRootfs` in `HostConfig` through `service create` and `service update`. Related docs has been updated. Integration test has been added. This fix fixes 29972. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@ -341,6 +341,14 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
|
||||
cspec.TTY = tty
|
||||
}
|
||||
|
||||
if flags.Changed(flagReadOnly) {
|
||||
readOnly, err := flags.GetBool(flagReadOnly)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cspec.ReadOnly = readOnly
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user