Merge pull request #2300 from vvoland/vendor-moby-v26-0.13

[0.13] vendor: github.com/docker/docker v26.0.0-rc1
This commit is contained in:
Tõnis Tiigi 2024-03-04 10:04:39 -08:00 committed by GitHub
commit 84913655a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 176 additions and 349 deletions

View File

@ -33,7 +33,7 @@ import (
"github.com/docker/buildx/util/resolver" "github.com/docker/buildx/util/resolver"
"github.com/docker/buildx/util/waitmap" "github.com/docker/buildx/util/waitmap"
"github.com/docker/cli/opts" "github.com/docker/cli/opts"
"github.com/docker/docker/api/types" imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/builder/remotecontext/urlutil" "github.com/docker/docker/builder/remotecontext/urlutil"
"github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/jsonmessage"
"github.com/moby/buildkit/client" "github.com/moby/buildkit/client"
@ -1002,7 +1002,7 @@ func pushWithMoby(ctx context.Context, d driver.Driver, name string, l progress.
return err return err
} }
rc, err := api.ImagePush(ctx, name, types.ImagePushOptions{ rc, err := api.ImagePush(ctx, name, imagetypes.PushOptions{
RegistryAuth: creds, RegistryAuth: creds,
}) })
if err != nil { if err != nil {

View File

@ -20,6 +20,7 @@ import (
"github.com/docker/cli/opts" "github.com/docker/cli/opts"
dockertypes "github.com/docker/docker/api/types" dockertypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/container"
imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/system" "github.com/docker/docker/api/types/system"
@ -95,7 +96,7 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error {
if err != nil { if err != nil {
return err return err
} }
rc, err := d.DockerAPI.ImageCreate(ctx, imageName, dockertypes.ImageCreateOptions{ rc, err := d.DockerAPI.ImageCreate(ctx, imageName, imagetypes.CreateOptions{
RegistryAuth: ra, RegistryAuth: ra,
}) })
if err != nil { if err != nil {

4
go.mod
View File

@ -14,9 +14,9 @@ require (
github.com/containerd/typeurl/v2 v2.1.1 github.com/containerd/typeurl/v2 v2.1.1
github.com/creack/pty v1.1.18 github.com/creack/pty v1.1.18
github.com/distribution/reference v0.5.0 github.com/distribution/reference v0.5.0
github.com/docker/cli v25.0.3+incompatible github.com/docker/cli v26.0.0-rc1+incompatible
github.com/docker/cli-docs-tool v0.7.0 github.com/docker/cli-docs-tool v0.7.0
github.com/docker/docker v25.0.3+incompatible github.com/docker/docker v26.0.0-rc1+incompatible
github.com/docker/go-units v0.5.0 github.com/docker/go-units v0.5.0
github.com/gofrs/flock v0.8.1 github.com/gofrs/flock v0.8.1
github.com/gogo/protobuf v1.3.2 github.com/gogo/protobuf v1.3.2

8
go.sum
View File

@ -121,15 +121,15 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v25.0.3+incompatible h1:KLeNs7zws74oFuVhgZQ5ONGZiXUUdgsdy6/EsX/6284= github.com/docker/cli v26.0.0-rc1+incompatible h1:PVxv2ySd8iZHoNfoAoKcnWSC/hKP2qMb806PWM34v50=
github.com/docker/cli v25.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v26.0.0-rc1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli-docs-tool v0.7.0 h1:M2Da98Unz2kz3A5d4yeSGbhyOge2mfYSNjAFt01Rw0M= github.com/docker/cli-docs-tool v0.7.0 h1:M2Da98Unz2kz3A5d4yeSGbhyOge2mfYSNjAFt01Rw0M=
github.com/docker/cli-docs-tool v0.7.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o= github.com/docker/cli-docs-tool v0.7.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v25.0.3+incompatible h1:D5fy/lYmY7bvZa0XTZ5/UJPljor41F+vdyJG5luQLfQ= github.com/docker/docker v26.0.0-rc1+incompatible h1:8Q4f+KSdA4hFc5SXcxthv1vR9HIoRwwjhBnMZL6IpkU=
github.com/docker/docker v25.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v26.0.0-rc1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8=
github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=

View File

@ -1,12 +1,12 @@
package socket package socket
import ( import (
"crypto/rand"
"encoding/hex"
"errors" "errors"
"io" "io"
"net" "net"
"os" "os"
"github.com/docker/distribution/uuid"
) )
// EnvKey represents the well-known environment variable used to pass the plugin being // EnvKey represents the well-known environment variable used to pass the plugin being
@ -17,7 +17,7 @@ const EnvKey = "DOCKER_CLI_PLUGIN_SOCKET"
// and update the conn pointer, and returns the listener for the socket (which the caller // and update the conn pointer, and returns the listener for the socket (which the caller
// is responsible for closing when it's no longer needed). // is responsible for closing when it's no longer needed).
func SetupConn(conn **net.UnixConn) (*net.UnixListener, error) { func SetupConn(conn **net.UnixConn) (*net.UnixListener, error) {
listener, err := listen("docker_cli_" + uuid.Generate().String()) listener, err := listen("docker_cli_" + randomID())
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -27,6 +27,14 @@ func SetupConn(conn **net.UnixConn) (*net.UnixListener, error) {
return listener, nil return listener, nil
} }
func randomID() string {
b := make([]byte, 16)
if _, err := rand.Read(b); err != nil {
panic(err) // This shouldn't happen
}
return hex.EncodeToString(b)
}
func accept(listener *net.UnixListener, conn **net.UnixConn) { func accept(listener *net.UnixListener, conn **net.UnixConn) {
go func() { go func() {
for { for {

View File

@ -1,4 +1,4 @@
//go:build !darwin //go:build !darwin && !openbsd
package socket package socket
@ -15,5 +15,6 @@ func listen(socketname string) (*net.UnixListener, error) {
func onAccept(conn *net.UnixConn, listener *net.UnixListener) { func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
// do nothing // do nothing
// while on darwin we would unlink here; on non-darwin the socket is abstract and not present on the filesystem // while on darwin and OpenBSD we would unlink here;
// on non-darwin the socket is abstract and not present on the filesystem
} }

View File

@ -0,0 +1,19 @@
package socket
import (
"net"
"os"
"path/filepath"
"syscall"
)
func listen(socketname string) (*net.UnixListener, error) {
return net.ListenUnix("unix", &net.UnixAddr{
Name: filepath.Join(os.TempDir(), socketname),
Net: "unix",
})
}
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
syscall.Unlink(listener.Addr().String())
}

View File

@ -11,19 +11,11 @@ import (
"github.com/moby/term" "github.com/moby/term"
) )
// CLIOption applies a modification on a DockerCli. // CLIOption is a functional argument to apply options to a [DockerCli]. These
// options can be passed to [NewDockerCli] to initialize a new CLI, or
// applied with [DockerCli.Initialize] or [DockerCli.Apply].
type CLIOption func(cli *DockerCli) error type CLIOption func(cli *DockerCli) error
// DockerCliOption applies a modification on a DockerCli.
//
// Deprecated: use [CLIOption] instead.
type DockerCliOption = CLIOption
// InitializeOpt is the type of the functional options passed to DockerCli.Initialize
//
// Deprecated: use [CLIOption] instead.
type InitializeOpt = CLIOption
// WithStandardStreams sets a cli in, out and err streams with the standard streams. // WithStandardStreams sets a cli in, out and err streams with the standard streams.
func WithStandardStreams() CLIOption { func WithStandardStreams() CLIOption {
return func(cli *DockerCli) error { return func(cli *DockerCli) error {

View File

@ -131,6 +131,8 @@ func (m *MountOpt) Set(value string) error {
return fmt.Errorf("invalid value for %s: %s (must be \"enabled\", \"disabled\", \"writable\", or \"readonly\")", return fmt.Errorf("invalid value for %s: %s (must be \"enabled\", \"disabled\", \"writable\", or \"readonly\")",
key, val) key, val)
} }
case "volume-subpath":
volumeOptions().Subpath = val
case "volume-nocopy": case "volume-nocopy":
volumeOptions().NoCopy, err = strconv.ParseBool(val) volumeOptions().NoCopy, err = strconv.ParseBool(val)
if err != nil { if err != nil {

View File

@ -2,8 +2,17 @@ package api // import "github.com/docker/docker/api"
// Common constants for daemon and client. // Common constants for daemon and client.
const ( const (
// DefaultVersion of Current REST API // DefaultVersion of the current REST API.
DefaultVersion = "1.44" DefaultVersion = "1.45"
// MinSupportedAPIVersion is the minimum API version that can be supported
// by the API server, specified as "major.minor". Note that the daemon
// may be configured with a different minimum API version, as returned
// in [github.com/docker/docker/api/types.Version.MinAPIVersion].
//
// API requests for API versions lower than the configured version produce
// an error.
MinSupportedAPIVersion = "1.24"
// NoBaseImageSpecifier is the symbol used by the FROM // NoBaseImageSpecifier is the symbol used by the FROM
// command to specify that no base image is to be used. // command to specify that no base image is to be used.

View File

@ -19,10 +19,10 @@ produces:
consumes: consumes:
- "application/json" - "application/json"
- "text/plain" - "text/plain"
basePath: "/v1.44" basePath: "/v1.45"
info: info:
title: "Docker Engine API" title: "Docker Engine API"
version: "1.44" version: "1.45"
x-logo: x-logo:
url: "https://docs.docker.com/assets/images/logo-docker-main.png" url: "https://docs.docker.com/assets/images/logo-docker-main.png"
description: | description: |
@ -55,8 +55,8 @@ info:
the URL is not supported by the daemon, a HTTP `400 Bad Request` error message the URL is not supported by the daemon, a HTTP `400 Bad Request` error message
is returned. is returned.
If you omit the version-prefix, the current version of the API (v1.44) is used. If you omit the version-prefix, the current version of the API (v1.45) is used.
For example, calling `/info` is the same as calling `/v1.44/info`. Using the For example, calling `/info` is the same as calling `/v1.45/info`. Using the
API without a version-prefix is deprecated and will be removed in a future release. API without a version-prefix is deprecated and will be removed in a future release.
Engine releases in the near future should support this version of the API, Engine releases in the near future should support this version of the API,
@ -391,7 +391,11 @@ definitions:
ReadOnlyNonRecursive: ReadOnlyNonRecursive:
description: | description: |
Make the mount non-recursively read-only, but still leave the mount recursive Make the mount non-recursively read-only, but still leave the mount recursive
(unless NonRecursive is set to true in conjunction). (unless NonRecursive is set to `true` in conjunction).
Addded in v1.44, before that version all read-only mounts were
non-recursive by default. To match the previous behaviour this
will default to `true` for clients on versions prior to v1.44.
type: "boolean" type: "boolean"
default: false default: false
ReadOnlyForceRecursive: ReadOnlyForceRecursive:
@ -423,6 +427,10 @@ definitions:
type: "object" type: "object"
additionalProperties: additionalProperties:
type: "string" type: "string"
Subpath:
description: "Source path inside the volume. Must be relative without any back traversals."
type: "string"
example: "dir-inside-volume/subdirectory"
TmpfsOptions: TmpfsOptions:
description: "Optional configuration for the `tmpfs` type." description: "Optional configuration for the `tmpfs` type."
type: "object" type: "object"
@ -1743,8 +1751,12 @@ definitions:
description: | description: |
Date and time at which the image was created, formatted in Date and time at which the image was created, formatted in
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
This information is only available if present in the image,
and omitted otherwise.
type: "string" type: "string"
x-nullable: false format: "dateTime"
x-nullable: true
example: "2022-02-04T21:20:12.497794809Z" example: "2022-02-04T21:20:12.497794809Z"
Container: Container:
description: | description: |

View File

@ -157,42 +157,12 @@ type ImageBuildResponse struct {
OSType string OSType string
} }
// ImageCreateOptions holds information to create images.
type ImageCreateOptions struct {
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry.
Platform string // Platform is the target platform of the image if it needs to be pulled from the registry.
}
// ImageImportSource holds source information for ImageImport // ImageImportSource holds source information for ImageImport
type ImageImportSource struct { type ImageImportSource struct {
Source io.Reader // Source is the data to send to the server to create this image from. You must set SourceName to "-" to leverage this. Source io.Reader // Source is the data to send to the server to create this image from. You must set SourceName to "-" to leverage this.
SourceName string // SourceName is the name of the image to pull. Set to "-" to leverage the Source attribute. SourceName string // SourceName is the name of the image to pull. Set to "-" to leverage the Source attribute.
} }
// ImageImportOptions holds information to import images from the client host.
type ImageImportOptions struct {
Tag string // Tag is the name to tag this image with. This attribute is deprecated.
Message string // Message is the message to tag the image with
Changes []string // Changes are the raw changes to apply to this image
Platform string // Platform is the target platform of the image
}
// ImageListOptions holds parameters to list images with.
type ImageListOptions struct {
// All controls whether all images in the graph are filtered, or just
// the heads.
All bool
// Filters is a JSON-encoded set of filter arguments.
Filters filters.Args
// SharedSize indicates whether the shared size of images should be computed.
SharedSize bool
// ContainerCount indicates whether container count should be computed.
ContainerCount bool
}
// ImageLoadResponse returns information to the client about a load process. // ImageLoadResponse returns information to the client about a load process.
type ImageLoadResponse struct { type ImageLoadResponse struct {
// Body must be closed to avoid a resource leak // Body must be closed to avoid a resource leak
@ -200,14 +170,6 @@ type ImageLoadResponse struct {
JSON bool JSON bool
} }
// ImagePullOptions holds information to pull images.
type ImagePullOptions struct {
All bool
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
PrivilegeFunc RequestPrivilegeFunc
Platform string
}
// RequestPrivilegeFunc is a function interface that // RequestPrivilegeFunc is a function interface that
// clients can supply to retry operations after // clients can supply to retry operations after
// getting an authorization error. // getting an authorization error.
@ -216,15 +178,6 @@ type ImagePullOptions struct {
// if the privilege request fails. // if the privilege request fails.
type RequestPrivilegeFunc func() (string, error) type RequestPrivilegeFunc func() (string, error)
// ImagePushOptions holds information to push images.
type ImagePushOptions ImagePullOptions
// ImageRemoveOptions holds parameters to remove images.
type ImageRemoveOptions struct {
Force bool
PruneChildren bool
}
// ImageSearchOptions holds parameters to search images with. // ImageSearchOptions holds parameters to search images with.
type ImageSearchOptions struct { type ImageSearchOptions struct {
RegistryAuth string RegistryAuth string

View File

@ -5,8 +5,8 @@ import (
"time" "time"
"github.com/docker/docker/api/types/strslice" "github.com/docker/docker/api/types/strslice"
dockerspec "github.com/docker/docker/image/spec/specs-go/v1"
"github.com/docker/go-connections/nat" "github.com/docker/go-connections/nat"
dockerspec "github.com/moby/docker-image-spec/specs-go/v1"
) )
// MinimumDuration puts a minimum on user configured duration. // MinimumDuration puts a minimum on user configured duration.

View File

@ -1,9 +1,57 @@
package image package image
import ocispec "github.com/opencontainers/image-spec/specs-go/v1" import "github.com/docker/docker/api/types/filters"
// GetImageOpts holds parameters to inspect an image. // ImportOptions holds information to import images from the client host.
type GetImageOpts struct { type ImportOptions struct {
Platform *ocispec.Platform Tag string // Tag is the name to tag this image with. This attribute is deprecated.
Details bool Message string // Message is the message to tag the image with
Changes []string // Changes are the raw changes to apply to this image
Platform string // Platform is the target platform of the image
}
// CreateOptions holds information to create images.
type CreateOptions struct {
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry.
Platform string // Platform is the target platform of the image if it needs to be pulled from the registry.
}
// PullOptions holds information to pull images.
type PullOptions struct {
All bool
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
// PrivilegeFunc is a function that clients can supply to retry operations
// after getting an authorization error. This function returns the registry
// authentication header value in base64 encoded format, or an error if the
// privilege request fails.
//
// Also see [github.com/docker/docker/api/types.RequestPrivilegeFunc].
PrivilegeFunc func() (string, error)
Platform string
}
// PushOptions holds information to push images.
type PushOptions PullOptions
// ListOptions holds parameters to list images with.
type ListOptions struct {
// All controls whether all images in the graph are filtered, or just
// the heads.
All bool
// Filters is a JSON-encoded set of filter arguments.
Filters filters.Args
// SharedSize indicates whether the shared size of images should be computed.
SharedSize bool
// ContainerCount indicates whether container count should be computed.
ContainerCount bool
}
// RemoveOptions holds parameters to remove images.
type RemoveOptions struct {
Force bool
PruneChildren bool
} }

View File

@ -96,6 +96,7 @@ type BindOptions struct {
type VolumeOptions struct { type VolumeOptions struct {
NoCopy bool `json:",omitempty"` NoCopy bool `json:",omitempty"`
Labels map[string]string `json:",omitempty"` Labels map[string]string `json:",omitempty"`
Subpath string `json:",omitempty"`
DriverConfig *Driver `json:",omitempty"` DriverConfig *Driver `json:",omitempty"`
} }

View File

@ -72,7 +72,10 @@ type ImageInspect struct {
// Created is the date and time at which the image was created, formatted in // Created is the date and time at which the image was created, formatted in
// RFC 3339 nano-seconds (time.RFC3339Nano). // RFC 3339 nano-seconds (time.RFC3339Nano).
Created string //
// This information is only available if present in the image,
// and omitted otherwise.
Created string `json:",omitempty"`
// Container is the ID of the container that was used to create the image. // Container is the ID of the container that was used to create the image.
// //

View File

@ -1,138 +1,35 @@
package types package types
import ( import (
"github.com/docker/docker/api/types/checkpoint"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/system"
) )
// CheckpointCreateOptions holds parameters to create a checkpoint from a container. // ImageImportOptions holds information to import images from the client host.
// //
// Deprecated: use [checkpoint.CreateOptions]. // Deprecated: use [image.ImportOptions].
type CheckpointCreateOptions = checkpoint.CreateOptions type ImageImportOptions = image.ImportOptions
// CheckpointListOptions holds parameters to list checkpoints for a container // ImageCreateOptions holds information to create images.
// //
// Deprecated: use [checkpoint.ListOptions]. // Deprecated: use [image.CreateOptions].
type CheckpointListOptions = checkpoint.ListOptions type ImageCreateOptions = image.CreateOptions
// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container // ImagePullOptions holds information to pull images.
// //
// Deprecated: use [checkpoint.DeleteOptions]. // Deprecated: use [image.PullOptions].
type CheckpointDeleteOptions = checkpoint.DeleteOptions type ImagePullOptions = image.PullOptions
// Checkpoint represents the details of a checkpoint when listing endpoints. // ImagePushOptions holds information to push images.
// //
// Deprecated: use [checkpoint.Summary]. // Deprecated: use [image.PushOptions].
type Checkpoint = checkpoint.Summary type ImagePushOptions = image.PushOptions
// Info contains response of Engine API: // ImageListOptions holds parameters to list images with.
// GET "/info"
// //
// Deprecated: use [system.Info]. // Deprecated: use [image.ListOptions].
type Info = system.Info type ImageListOptions = image.ListOptions
// Commit holds the Git-commit (SHA1) that a binary was built from, as reported // ImageRemoveOptions holds parameters to remove images.
// in the version-string of external tools, such as containerd, or runC.
// //
// Deprecated: use [system.Commit]. // Deprecated: use [image.RemoveOptions].
type Commit = system.Commit type ImageRemoveOptions = image.RemoveOptions
// PluginsInfo is a temp struct holding Plugins name
// registered with docker daemon. It is used by [system.Info] struct
//
// Deprecated: use [system.PluginsInfo].
type PluginsInfo = system.PluginsInfo
// NetworkAddressPool is a temp struct used by [system.Info] struct.
//
// Deprecated: use [system.NetworkAddressPool].
type NetworkAddressPool = system.NetworkAddressPool
// Runtime describes an OCI runtime.
//
// Deprecated: use [system.Runtime].
type Runtime = system.Runtime
// SecurityOpt contains the name and options of a security option.
//
// Deprecated: use [system.SecurityOpt].
type SecurityOpt = system.SecurityOpt
// KeyValue holds a key/value pair.
//
// Deprecated: use [system.KeyValue].
type KeyValue = system.KeyValue
// ImageDeleteResponseItem image delete response item.
//
// Deprecated: use [image.DeleteResponse].
type ImageDeleteResponseItem = image.DeleteResponse
// ImageSummary image summary.
//
// Deprecated: use [image.Summary].
type ImageSummary = image.Summary
// ImageMetadata contains engine-local data about the image.
//
// Deprecated: use [image.Metadata].
type ImageMetadata = image.Metadata
// ServiceCreateResponse contains the information returned to a client
// on the creation of a new service.
//
// Deprecated: use [swarm.ServiceCreateResponse].
type ServiceCreateResponse = swarm.ServiceCreateResponse
// ServiceUpdateResponse service update response.
//
// Deprecated: use [swarm.ServiceUpdateResponse].
type ServiceUpdateResponse = swarm.ServiceUpdateResponse
// ContainerStartOptions holds parameters to start containers.
//
// Deprecated: use [container.StartOptions].
type ContainerStartOptions = container.StartOptions
// ResizeOptions holds parameters to resize a TTY.
// It can be used to resize container TTYs and
// exec process TTYs too.
//
// Deprecated: use [container.ResizeOptions].
type ResizeOptions = container.ResizeOptions
// ContainerAttachOptions holds parameters to attach to a container.
//
// Deprecated: use [container.AttachOptions].
type ContainerAttachOptions = container.AttachOptions
// ContainerCommitOptions holds parameters to commit changes into a container.
//
// Deprecated: use [container.CommitOptions].
type ContainerCommitOptions = container.CommitOptions
// ContainerListOptions holds parameters to list containers with.
//
// Deprecated: use [container.ListOptions].
type ContainerListOptions = container.ListOptions
// ContainerLogsOptions holds parameters to filter logs with.
//
// Deprecated: use [container.LogsOptions].
type ContainerLogsOptions = container.LogsOptions
// ContainerRemoveOptions holds parameters to remove containers.
//
// Deprecated: use [container.RemoveOptions].
type ContainerRemoveOptions = container.RemoveOptions
// DecodeSecurityOptions decodes a security options string slice to a type safe
// [system.SecurityOpt].
//
// Deprecated: use [system.DecodeSecurityOptions].
func DecodeSecurityOptions(opts []string) ([]system.SecurityOpt, error) {
return system.DecodeSecurityOptions(opts)
}

View File

@ -1,14 +0,0 @@
# Legacy API type versions
This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`.
Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`.
## Package name conventions
The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention:
1. We cannot use `.` because it's interpreted by the language, think of `v1.20.CallFunction`.
2. We cannot use `_` because golint complains about it. The code is actually valid, but it looks probably more weird: `v1_20.CallFunction`.
For instance, if you want to modify a type that was available in the version `1.21` of the API but it will have different fields in the version `1.22`, you want to create a new package under `api/types/versions/v1p21`.

View File

@ -10,11 +10,11 @@ import (
) )
// DistributionInspect returns the image digest with the full manifest. // DistributionInspect returns the image digest with the full manifest.
func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registry.DistributionInspect, error) { func (cli *Client) DistributionInspect(ctx context.Context, imageRef, encodedRegistryAuth string) (registry.DistributionInspect, error) {
// Contact the registry to retrieve digest and platform information // Contact the registry to retrieve digest and platform information
var distributionInspect registry.DistributionInspect var distributionInspect registry.DistributionInspect
if image == "" { if imageRef == "" {
return distributionInspect, objectNotFoundError{object: "distribution", id: image} return distributionInspect, objectNotFoundError{object: "distribution", id: imageRef}
} }
if err := cli.NewVersionError(ctx, "1.30", "distribution inspect"); err != nil { if err := cli.NewVersionError(ctx, "1.30", "distribution inspect"); err != nil {
@ -28,7 +28,7 @@ func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegist
} }
} }
resp, err := cli.get(ctx, "/distribution/"+image+"/json", url.Values{}, headers) resp, err := cli.get(ctx, "/distribution/"+imageRef+"/json", url.Values{}, headers)
defer ensureReaderClosed(resp) defer ensureReaderClosed(resp)
if err != nil { if err != nil {
return distributionInspect, err return distributionInspect, err

View File

@ -8,13 +8,13 @@ import (
"strings" "strings"
"github.com/distribution/reference" "github.com/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/registry"
) )
// ImageCreate creates a new image based on the parent options. // ImageCreate creates a new image based on the parent options.
// It returns the JSON content in the response body. // It returns the JSON content in the response body.
func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) {
ref, err := reference.ParseNormalizedNamed(parentReference) ref, err := reference.ParseNormalizedNamed(parentReference)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -8,11 +8,12 @@ import (
"github.com/distribution/reference" "github.com/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
) )
// ImageImport creates a new image based on the source options. // ImageImport creates a new image based on the source options.
// It returns the JSON content in the response body. // It returns the JSON content in the response body.
func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
if ref != "" { if ref != "" {
// Check if the given image name can be resolved // Check if the given image name can be resolved
if _, err := reference.ParseNormalizedNamed(ref); err != nil { if _, err := reference.ParseNormalizedNamed(ref); err != nil {

View File

@ -5,14 +5,13 @@ import (
"encoding/json" "encoding/json"
"net/url" "net/url"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/versions" "github.com/docker/docker/api/types/versions"
) )
// ImageList returns a list of images in the docker host. // ImageList returns a list of images in the docker host.
func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) { func (cli *Client) ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error) {
// Make sure we negotiated (if the client is configured to do so), // Make sure we negotiated (if the client is configured to do so),
// as code below contains API-version specific handling of options. // as code below contains API-version specific handling of options.
// //

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
"github.com/distribution/reference" "github.com/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
) )
@ -19,7 +19,7 @@ import (
// FIXME(vdemeester): there is currently used in a few way in docker/docker // FIXME(vdemeester): there is currently used in a few way in docker/docker
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty // - if not in trusted content, ref is used to pass the whole reference, and tag is empty
// - if in trusted content, ref is used to pass the reference name, and tag for the digest // - if in trusted content, ref is used to pass the reference name, and tag for the digest
func (cli *Client) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error) { func (cli *Client) ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error) {
ref, err := reference.ParseNormalizedNamed(refStr) ref, err := reference.ParseNormalizedNamed(refStr)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -8,7 +8,7 @@ import (
"net/url" "net/url"
"github.com/distribution/reference" "github.com/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
) )
@ -17,7 +17,7 @@ import (
// It executes the privileged function if the operation is unauthorized // It executes the privileged function if the operation is unauthorized
// and it tries one more time. // and it tries one more time.
// It's up to the caller to handle the io.ReadCloser and close it properly. // It's up to the caller to handle the io.ReadCloser and close it properly.
func (cli *Client) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error) { func (cli *Client) ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) {
ref, err := reference.ParseNormalizedNamed(image) ref, err := reference.ParseNormalizedNamed(image)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -5,12 +5,11 @@ import (
"encoding/json" "encoding/json"
"net/url" "net/url"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
) )
// ImageRemove removes an image from the docker host. // ImageRemove removes an image from the docker host.
func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { func (cli *Client) ImageRemove(ctx context.Context, imageID string, options image.RemoveOptions) ([]image.DeleteResponse, error) {
query := url.Values{} query := url.Values{}
if options.Force { if options.Force {

View File

@ -90,15 +90,15 @@ type ImageAPIClient interface {
ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error)
BuildCancel(ctx context.Context, id string) error BuildCancel(ctx context.Context, id string) error
ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error)
ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error) ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error) ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) ImageRemove(ctx context.Context, image string, options image.RemoveOptions) ([]image.DeleteResponse, error)
ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
ImageTag(ctx context.Context, image, ref string) error ImageTag(ctx context.Context, image, ref string) error

View File

@ -1,54 +0,0 @@
package v1
import (
"time"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
const DockerOCIImageMediaType = "application/vnd.docker.container.image.v1+json"
// DockerOCIImage is a ocispec.Image extended with Docker specific Config.
type DockerOCIImage struct {
ocispec.Image
// Shadow ocispec.Image.Config
Config DockerOCIImageConfig `json:"config,omitempty"`
}
// DockerOCIImageConfig is a ocispec.ImageConfig extended with Docker specific fields.
type DockerOCIImageConfig struct {
ocispec.ImageConfig
DockerOCIImageConfigExt
}
// DockerOCIImageConfigExt contains Docker-specific fields in DockerImageConfig.
type DockerOCIImageConfigExt struct {
Healthcheck *HealthcheckConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile
Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
}
// HealthcheckConfig holds configuration settings for the HEALTHCHECK feature.
type HealthcheckConfig struct {
// Test is the test to perform to check that the container is healthy.
// An empty slice means to inherit the default.
// The options are:
// {} : inherit healthcheck
// {"NONE"} : disable healthcheck
// {"CMD", args...} : exec arguments directly
// {"CMD-SHELL", command} : run command with system's default shell
Test []string `json:",omitempty"`
// Zero means to inherit. Durations are expressed as integer nanoseconds.
Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.
StartInterval time.Duration `json:",omitempty"` // The interval to attempt healthchecks at during the start period
// Retries is the number of consecutive failures needed to consider a container as unhealthy.
// Zero means inherit.
Retries int `json:",omitempty"`
}

View File

@ -6,14 +6,6 @@ import (
"runtime" "runtime"
) )
// Key returns the env var name for the user's home dir based on
// the platform being run on.
//
// Deprecated: this function is no longer used, and will be removed in the next release.
func Key() string {
return envKeyName
}
// Get returns the home directory of the current user with the help of // Get returns the home directory of the current user with the help of
// environment variables depending on the target operating system. // environment variables depending on the target operating system.
// Returned path should be used with "path/filepath" to form new paths. // Returned path should be used with "path/filepath" to form new paths.
@ -34,11 +26,3 @@ func Get() string {
} }
return home return home
} }
// GetShortcutString returns the string that is shortcut to user's home directory
// in the native shell of the platform running on.
//
// Deprecated: this function is no longer used, and will be removed in the next release.
func GetShortcutString() string {
return homeShortCut
}

View File

@ -1,8 +0,0 @@
//go:build !windows
package homedir // import "github.com/docker/docker/pkg/homedir"
const (
envKeyName = "HOME"
homeShortCut = "~"
)

View File

@ -1,6 +0,0 @@
package homedir // import "github.com/docker/docker/pkg/homedir"
const (
envKeyName = "USERPROFILE"
homeShortCut = "%USERPROFILE%" // be careful while using in format functions
)

View File

@ -1,19 +0,0 @@
package system
import (
"errors"
"runtime"
"strings"
)
// ErrNotSupportedOperatingSystem means the operating system is not supported.
//
// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned.
var ErrNotSupportedOperatingSystem = errors.New("operating system is not supported")
// IsOSSupported determines if an operating system is supported by the host.
//
// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned.
func IsOSSupported(os string) bool {
return strings.EqualFold(runtime.GOOS, os)
}

5
vendor/modules.txt vendored
View File

@ -215,7 +215,7 @@ github.com/davecgh/go-spew/spew
# github.com/distribution/reference v0.5.0 # github.com/distribution/reference v0.5.0
## explicit; go 1.20 ## explicit; go 1.20
github.com/distribution/reference github.com/distribution/reference
# github.com/docker/cli v25.0.3+incompatible # github.com/docker/cli v26.0.0-rc1+incompatible
## explicit ## explicit
github.com/docker/cli/cli github.com/docker/cli/cli
github.com/docker/cli/cli-plugins/manager github.com/docker/cli/cli-plugins/manager
@ -268,7 +268,7 @@ github.com/docker/distribution/registry/client/transport
github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache
github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/registry/storage/cache/memory
github.com/docker/distribution/uuid github.com/docker/distribution/uuid
# github.com/docker/docker v25.0.3+incompatible # github.com/docker/docker v26.0.0-rc1+incompatible
## explicit ## explicit
github.com/docker/docker/api github.com/docker/docker/api
github.com/docker/docker/api/types github.com/docker/docker/api/types
@ -291,7 +291,6 @@ github.com/docker/docker/api/types/volume
github.com/docker/docker/builder/remotecontext/urlutil github.com/docker/docker/builder/remotecontext/urlutil
github.com/docker/docker/client github.com/docker/docker/client
github.com/docker/docker/errdefs github.com/docker/docker/errdefs
github.com/docker/docker/image/spec/specs-go/v1
github.com/docker/docker/internal/multierror github.com/docker/docker/internal/multierror
github.com/docker/docker/pkg/archive github.com/docker/docker/pkg/archive
github.com/docker/docker/pkg/homedir github.com/docker/docker/pkg/homedir