1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

service: support --mount type=bind,bind-nonrecursive

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2019-02-23 23:53:28 +09:00 committed by Akihiro Suda
parent d959c20b44
commit 745fa04e52
3 changed files with 11 additions and 5 deletions

View file

@ -79,6 +79,7 @@ func containerSpecFromGRPC(c *swarmapi.ContainerSpec) *types.ContainerSpec {
if m.BindOptions != nil {
mount.BindOptions = &mounttypes.BindOptions{
Propagation: mounttypes.Propagation(strings.ToLower(swarmapi.Mount_BindOptions_MountPropagation_name[int32(m.BindOptions.Propagation)])),
NonRecursive: m.BindOptions.NonRecursive,
}
}
@ -331,9 +332,11 @@ func containerToGRPC(c *types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
}
if m.BindOptions.NonRecursive {
// TODO(AkihiroSuda): NonRecursive is unsupported for Swarm-mode now because of mutual vendoring
// across moby and swarmkit. Will be available soon after the moby PR gets merged.
return nil, fmt.Errorf("invalid NonRecursive: %q", m.BindOptions.Propagation)
if mount.BindOptions == nil {
// the propagation defaults to rprivate
mount.BindOptions = &swarmapi.Mount_BindOptions{}
}
mount.BindOptions.NonRecursive = m.BindOptions.NonRecursive
}
}

View file

@ -281,7 +281,9 @@ func convertMount(m api.Mount) enginemount.Mount {
}
if m.BindOptions != nil {
mount.BindOptions = &enginemount.BindOptions{}
mount.BindOptions = &enginemount.BindOptions{
NonRecursive: m.BindOptions.NonRecursive,
}
switch m.BindOptions.Propagation {
case api.MountPropagationRPrivate:
mount.BindOptions.Propagation = enginemount.PropagationRPrivate

View file

@ -17,6 +17,7 @@ keywords: "API, Docker, rcli, REST, documentation"
[Docker Engine API v1.41](https://docs.docker.com/engine/api/v1.41/) documentation
* `POST /services/create` and `POST /services/{id}/update` now supports `BindOptions.NonRecursive`.
* The `ClusterStore` and `ClusterAdvertise` fields in `GET /info` are deprecated
and are now omitted if they contain an empty value. This change is not versioned,
and affects all API versions if the daemon has this patch.