code: func (daemon *Daemon) Cleanup(container *container.Container) {
  	daemon.releaseNetwork(container)
  
  	if err := container.UnmountIpcMount(); err != nil {
  		logrus.Warnf("%s cleanup: failed to unmount IPC: %s", container.ID, err)
  	}
  
  	if err := daemon.conditionalUnmountOnCleanup(container); err != nil {
  		// FIXME: remove once reference counting for graphdrivers has been refactored
  		// Ensure that all the mounts are gone
  		if mountid, err := daemon.imageService.GetLayerMountID(container.ID, container.OS); err == nil {
  			daemon.cleanupMountsByID(mountid)
  		}
  	}
  
  	if err := container.UnmountSecrets(); err != nil {
  		logrus.Warnf("%s cleanup: failed to unmount secrets: %s", container.ID, err)
  	}
  
  	if err := mount.RecursiveUnmount(container.Root); err != nil {
  		logrus.WithError(err).WithField("container", container.ID).Warn("Error while cleaning up container resource mounts.")
  	}
  
  	for _, eConfig := range container.ExecCommands.Commands() {
  		daemon.unregisterExecCommand(container, eConfig)
  	}
  
  	if container.BaseFS != nil && container.BaseFS.Path() != "" {
  		if err := container.UnmountVolumes(daemon.LogVolumeEvent); err != nil {
  			logrus.Warnf("%s cleanup: Failed to umount volumes: %v", container.ID, err)
  		}
  	}
  
  	container.CancelAttachContext()
  
  	if err := daemon.containerd.Delete(context.Background(), container.ID); err != nil {
  		logrus.Errorf("%s cleanup: failed to delete container from containerd: %v", container.ID, err)
  	}
  }
docs: // Cleanup releases any network resources allocated to the container along with any rules
  // around how containers are linked together.  It also unmounts the container's root filesystem.