code: func WithBundle(bundleDir string, ociSpec *specs.Spec) containerd.NewContainerOpts {
  	return func(ctx context.Context, client *containerd.Client, c *containers.Container) error {
  		if c.Labels == nil {
  			c.Labels = make(map[string]string)
  		}
  		uid, gid := getSpecUser(ociSpec)
  		if uid == 0 && gid == 0 {
  			c.Labels[DockerContainerBundlePath] = bundleDir
  			return idtools.MkdirAllAndChownNew(bundleDir, 0755, idtools.Identity{UID: 0, GID: 0})
  		}
  
  		p := string(filepath.Separator)
  		components := strings.Split(bundleDir, string(filepath.Separator))
  		for _, d := range components[1:] {
  			p = filepath.Join(p, d)
  			fi, err := os.Stat(p)
  			if err != nil && !os.IsNotExist(err) {
  				return err
  			}
  			if os.IsNotExist(err) || fi.Mode()&1 == 0 {
  				p = fmt.Sprintf("%s.%d.%d", p, uid, gid)
  				if err := idtools.MkdirAndChown(p, 0700, idtools.Identity{UID: uid, GID: gid}); err != nil && !os.IsExist(err) {
  					return err
  				}
  			}
  		}
  		if c.Labels == nil {
  			c.Labels = make(map[string]string)
  		}
  		c.Labels[DockerContainerBundlePath] = p
  		return nil
  	}
  }
docs: // WithBundle creates the bundle for the container