https://github.com/compose-generator/diu
Docker Inspect Utils are a set of features to parse internal Docker objects.
https://github.com/compose-generator/diu
docker go golang json library utils
Last synced: 6 months ago
JSON representation
Docker Inspect Utils are a set of features to parse internal Docker objects.
- Host: GitHub
- URL: https://github.com/compose-generator/diu
- Owner: compose-generator
- License: apache-2.0
- Created: 2021-02-28T05:29:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-19T02:57:14.000Z (about 3 years ago)
- Last Synced: 2025-02-01T12:26:49.947Z (over 1 year ago)
- Topics: docker, go, golang, json, library, utils
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
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


[](https://goreportcard.com/report/github.com/compose-generator/diu)
[](https://codecov.io/gh/compose-generator/diu)
[](http://makeapullrequest.com)
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](https://github.com/compose-generator/compose-generator) project, but also can be used independently.*
## Installation
```sh
go get github.com/compose-generator/diu
```
## Usage
### Get manifest of remote image
Returns a struct with following structure: [Structure](model/manifest.go)
**Example:**
```go
// 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](model/volume.go)
**Example:**
```go
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](model/network.go)
**Example:**
```go
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](CONTRIBUTING.md).
© Marc Auberer 2021