github.com/jen20/docker@v1.13.1/daemon/changes.go (about)

     1  package daemon
     2  
     3  import (
     4  	"errors"
     5  	"runtime"
     6  	"time"
     7  
     8  	"github.com/docker/docker/pkg/archive"
     9  )
    10  
    11  // ContainerChanges returns a list of container fs changes
    12  func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error) {
    13  	start := time.Now()
    14  	container, err := daemon.GetContainer(name)
    15  	if err != nil {
    16  		return nil, err
    17  	}
    18  
    19  	if runtime.GOOS == "windows" && container.IsRunning() {
    20  		return nil, errors.New("Windows does not support diff of a running container")
    21  	}
    22  
    23  	container.Lock()
    24  	defer container.Unlock()
    25  	c, err := container.RWLayer.Changes()
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  	containerActions.WithValues("changes").UpdateSince(start)
    30  	return c, nil
    31  }