mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
introduce Containerd-snapshotter feature flag
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
74286cba8c
commit
33121d3d45
2 changed files with 16 additions and 4 deletions
|
@ -146,6 +146,16 @@ func (daemon *Daemon) Features() *map[string]bool {
|
|||
return &daemon.configStore.Features
|
||||
}
|
||||
|
||||
// usesSnapshotter returns true if feature flag to use containerd snapshotter is enabled
|
||||
func (daemon *Daemon) usesSnapshotter() bool {
|
||||
if daemon.configStore.Features != nil {
|
||||
if b, ok := daemon.configStore.Features["containerd-snapshotter"]; ok {
|
||||
return b
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// RegistryHosts returns registry configuration in containerd resolvers format
|
||||
func (daemon *Daemon) RegistryHosts() docker.RegistryHosts {
|
||||
var (
|
||||
|
|
|
@ -720,17 +720,19 @@ func sysctlExists(s string) bool {
|
|||
// WithCommonOptions sets common docker options
|
||||
func WithCommonOptions(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
||||
return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
|
||||
if c.BaseFS == nil {
|
||||
if c.BaseFS == nil && !daemon.usesSnapshotter() {
|
||||
return errors.New("populateCommonSpec: BaseFS of container " + c.ID + " is unexpectedly nil")
|
||||
}
|
||||
linkedEnv, err := daemon.setupLinkedContainers(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !daemon.usesSnapshotter() {
|
||||
s.Root = &specs.Root{
|
||||
Path: c.BaseFS.Path(),
|
||||
Readonly: c.HostConfig.ReadonlyRootfs,
|
||||
}
|
||||
}
|
||||
if err := c.SetupWorkingDirectory(daemon.idMapping.RootPair()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue