2018-02-05 21:05:59 +00:00
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
2015-05-02 01:03:35 +00:00
|
|
|
|
2016-07-20 23:11:28 +00:00
|
|
|
import (
|
2023-03-23 11:32:59 +00:00
|
|
|
"context"
|
2016-10-27 22:52:32 +00:00
|
|
|
"errors"
|
2016-07-20 23:11:28 +00:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/archive"
|
|
|
|
)
|
2015-05-02 01:03:35 +00:00
|
|
|
|
|
|
|
// ContainerChanges returns a list of container fs changes
|
2023-03-23 11:32:59 +00:00
|
|
|
func (daemon *Daemon) ContainerChanges(ctx context.Context, name string) ([]archive.Change, error) {
|
2016-07-20 23:11:28 +00:00
|
|
|
start := time.Now()
|
2023-03-23 11:32:59 +00:00
|
|
|
|
2015-12-11 17:39:28 +00:00
|
|
|
container, err := daemon.GetContainer(name)
|
2015-05-02 01:03:35 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2019-10-13 00:29:21 +00:00
|
|
|
if isWindows && container.IsRunning() {
|
2016-10-27 22:52:32 +00:00
|
|
|
return nil, errors.New("Windows does not support diff of a running container")
|
|
|
|
}
|
|
|
|
|
2023-03-23 11:32:59 +00:00
|
|
|
c, err := daemon.imageService.Changes(ctx, container)
|
2016-07-20 23:11:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
containerActions.WithValues("changes").UpdateSince(start)
|
|
|
|
return c, nil
|
2015-05-02 01:03:35 +00:00
|
|
|
}
|