Skip to content

Commit

Permalink
Merge pull request moby#4 from rumpl/c8d-snap-ff
Browse files Browse the repository at this point in the history
Introduce containerd-snapshotter feature flag
  • Loading branch information
rumpl committed Jul 5, 2022
2 parents a98bd75 + 869f257 commit f0cbb55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions daemon/daemon.go
Expand Up @@ -147,6 +147,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 (
Expand Down
8 changes: 7 additions & 1 deletion daemon/oci_linux.go
Expand Up @@ -720,13 +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,
}
}
s.Root = &specs.Root{
Path: c.BaseFS.Path(),
Readonly: c.HostConfig.ReadonlyRootfs,
Expand Down

0 comments on commit f0cbb55

Please sign in to comment.