MCPcopy
hub / github.com/docker/compose / VolumeHash

Function VolumeHash

pkg/compose/hash.go:55–64  ·  pkg/compose/hash.go::VolumeHash

VolumeHash computes the configuration hash for a volume.

(o types.VolumeConfig)

Source from the content-addressed store, hash-verified

53
54// VolumeHash computes the configuration hash for a volume.
55func VolumeHash(o types.VolumeConfig) (string, error) {
56 if o.Driver == "" { // (TODO: jhrotko) This probably should be fixed in compose-go
57 o.Driver = "local"
58 }
59 bytes, err := json.Marshal(o)
60 if err != nil {
61 return "", err
62 }
63 return digest.SHA256.FromBytes(bytes).Encoded(), nil
64}

Callers 3

ensureVolumeMethod · 0.85
createVolumeMethod · 0.85

Calls

no outgoing calls

Tested by 1