config: fix docker Go API deprecation
Signed-off-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
parent
3e804b81fe
commit
eadbe920fe
|
@ -4,8 +4,8 @@ import (
|
|||
"encoding/base64"
|
||||
"sort"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/goccy/go-json"
|
||||
)
|
||||
|
||||
|
@ -115,7 +115,7 @@ type RegistryConfiguration struct {
|
|||
// Base64 returns the authentication for a given registry as a base64 encoded
|
||||
// string value.
|
||||
func (c RegistryConfiguration) Base64() (string, error) {
|
||||
b, err := json.Marshal(types.AuthConfig{
|
||||
b, err := json.Marshal(registry.AuthConfig{
|
||||
Username: c.Username,
|
||||
Password: c.Password,
|
||||
})
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/acobaugh/osrelease"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/system"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
)
|
||||
|
@ -121,22 +122,22 @@ func GetSystemInformation() (*Information, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func GetDockerInfo(ctx context.Context) (types.Version, types.Info, error) {
|
||||
func GetDockerInfo(ctx context.Context) (types.Version, system.Info, error) {
|
||||
// TODO: find a way to re-use the client from the docker environment.
|
||||
c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||
if err != nil {
|
||||
return types.Version{}, types.Info{}, err
|
||||
return types.Version{}, system.Info{}, err
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
dockerVersion, err := c.ServerVersion(ctx)
|
||||
if err != nil {
|
||||
return types.Version{}, types.Info{}, err
|
||||
return types.Version{}, system.Info{}, err
|
||||
}
|
||||
|
||||
dockerInfo, err := c.Info(ctx)
|
||||
if err != nil {
|
||||
return types.Version{}, types.Info{}, err
|
||||
return types.Version{}, system.Info{}, err
|
||||
}
|
||||
|
||||
return dockerVersion, dockerInfo, nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user