This library is deprecated and is only used by Compose Generator until Docker Manifests are fully supported by the official Docker client. For that reason, please mind that this repository is not maintained anymore. |
---|
This Go library contains a set of useful features to parse internal Docker objects and put them into handelable objects or slices.
Note: This library is part of the Compose Generator project, but also can be used independently.
go get github.com/compose-generator/diu
Returns a struct with following structure: Structure
Example:
// You also can pass the image with a custom repository e.g.: ghcr.io/compose-generator/compose-generator
manifest, err := GetImageManifest("hello-world")
if err == nil {
// Print layer count of hello-world image
fmt.println("Number of layers: "+len(manifest.SchemaV2Manifest.Layers))
}
Returns a slice of structs with following structure: Structure
Example:
volumes, err := GetExistingVolumes()
if err == nil && len(volumes) > 0 {
// Print layer count of hello-world image
fmt.println("Name of first volume: "+volumes[0].Name)
}
Returns a slice of structs with following structure: Structure
Example:
networks, err := GetExistingNetworks()
if err == nil && len(networks) > 0 {
// Print layer count of hello-world image
fmt.println("Name of first networks: "+networks[0].Name)
}
If you want to contribute to this project, please ensure you comply with the contribution guidelines.
© Marc Auberer 2021