github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/client/container_diff.go (about)

     1  package client // import "github.com/Prakhar-Agarwal-byte/moby/client"
     2  
     3  import (
     4  	"context"
     5  	"encoding/json"
     6  	"net/url"
     7  
     8  	"github.com/Prakhar-Agarwal-byte/moby/api/types/container"
     9  )
    10  
    11  // ContainerDiff shows differences in a container filesystem since it was started.
    12  func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.FilesystemChange, error) {
    13  	var changes []container.FilesystemChange
    14  
    15  	serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil)
    16  	defer ensureReaderClosed(serverResp)
    17  	if err != nil {
    18  		return changes, err
    19  	}
    20  
    21  	err = json.NewDecoder(serverResp.body).Decode(&changes)
    22  	return changes, err
    23  }