repositorypackage
0.0.0-20221024073354-053efc03289e
Repository: https://github.com/compose-generator/diu.git
Documentation: pkg.go.dev
# README
:warning: | 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. |
---|
Docker Inspect Utils
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.
Installation
go get github.com/compose-generator/diu
Usage
Get manifest of remote image
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))
}
Get all volumes of local Docker instance
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)
}
Get all networks of local Docker instance
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)
}
Contribute to the project
If you want to contribute to this project, please ensure you comply with the contribution guidelines.
© Marc Auberer 2021