mirror of https://github.com/docker/cli.git
Merge pull request #4728 from thaJeztah/update_engine
vendor: github.com/docker/docker 388216fc45ab (v25.0.0-dev)
This commit is contained in:
commit
1f97a34ac2
|
@ -98,12 +98,14 @@ var sampleInfoNoSwarm = system.Info{
|
||||||
Labels: []string{"provider=digitalocean"},
|
Labels: []string{"provider=digitalocean"},
|
||||||
ExperimentalBuild: false,
|
ExperimentalBuild: false,
|
||||||
ServerVersion: "17.06.1-ce",
|
ServerVersion: "17.06.1-ce",
|
||||||
Runtimes: map[string]system.Runtime{
|
Runtimes: map[string]system.RuntimeWithStatus{
|
||||||
"runc": {
|
"runc": {
|
||||||
|
Runtime: system.Runtime{
|
||||||
Path: "docker-runc",
|
Path: "docker-runc",
|
||||||
Args: nil,
|
Args: nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
DefaultRuntime: "runc",
|
DefaultRuntime: "runc",
|
||||||
Swarm: swarm.Info{LocalNodeState: "inactive"},
|
Swarm: swarm.Info{LocalNodeState: "inactive"},
|
||||||
LiveRestoreEnabled: false,
|
LiveRestoreEnabled: false,
|
||||||
|
|
|
@ -12,7 +12,7 @@ require (
|
||||||
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/distribution v2.8.3+incompatible
|
github.com/docker/distribution v2.8.3+incompatible
|
||||||
github.com/docker/docker v25.0.0-beta.2.0.20231213091442-f3cc93630ed8+incompatible // master (v25.0.0-dev)
|
github.com/docker/docker v25.0.0-beta.2.0.20231219173513-388216fc45ab+incompatible // master (v25.0.0-dev)
|
||||||
github.com/docker/docker-credential-helpers v0.8.0
|
github.com/docker/docker-credential-helpers v0.8.0
|
||||||
github.com/docker/go-connections v0.4.1-0.20231110212414-fa09c952e3ea
|
github.com/docker/go-connections v0.4.1-0.20231110212414-fa09c952e3ea
|
||||||
github.com/docker/go-units v0.5.0
|
github.com/docker/go-units v0.5.0
|
||||||
|
|
|
@ -54,8 +54,8 @@ github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5
|
||||||
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.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
||||||
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/docker v25.0.0-beta.2.0.20231213091442-f3cc93630ed8+incompatible h1:3AprxtFaAOqGJGDLm2GoO6z1p2+KscPN8RGtJoA89HM=
|
github.com/docker/docker v25.0.0-beta.2.0.20231219173513-388216fc45ab+incompatible h1:ChEUgFlWcTpckX7kRdO3wCBwIWS7CeJJ3J+H4ZGWqxM=
|
||||||
github.com/docker/docker v25.0.0-beta.2.0.20231213091442-f3cc93630ed8+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v25.0.0-beta.2.0.20231219173513-388216fc45ab+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=
|
||||||
|
|
|
@ -1744,10 +1744,15 @@ definitions:
|
||||||
The ID of the container that was used to create the image.
|
The ID of the container that was used to create the image.
|
||||||
|
|
||||||
Depending on how the image was created, this field may be empty.
|
Depending on how the image was created, this field may be empty.
|
||||||
|
|
||||||
|
**Deprecated**: this field is kept for backward compatibility, but
|
||||||
|
will be removed in API v1.45.
|
||||||
type: "string"
|
type: "string"
|
||||||
x-nullable: false
|
|
||||||
example: "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735"
|
example: "65974bc86f1770ae4bff79f651ebdbce166ae9aada632ee3fa9af3a264911735"
|
||||||
ContainerConfig:
|
ContainerConfig:
|
||||||
|
description: |
|
||||||
|
**Deprecated**: this field is kept for backward compatibility, but
|
||||||
|
will be removed in API v1.45.
|
||||||
$ref: "#/definitions/ContainerConfig"
|
$ref: "#/definitions/ContainerConfig"
|
||||||
DockerVersion:
|
DockerVersion:
|
||||||
description: |
|
description: |
|
||||||
|
@ -3976,6 +3981,44 @@ definitions:
|
||||||
- "remove"
|
- "remove"
|
||||||
- "orphaned"
|
- "orphaned"
|
||||||
|
|
||||||
|
ContainerStatus:
|
||||||
|
type: "object"
|
||||||
|
description: "represents the status of a container."
|
||||||
|
properties:
|
||||||
|
ContainerID:
|
||||||
|
type: "string"
|
||||||
|
PID:
|
||||||
|
type: "integer"
|
||||||
|
ExitCode:
|
||||||
|
type: "integer"
|
||||||
|
|
||||||
|
PortStatus:
|
||||||
|
type: "object"
|
||||||
|
description: "represents the port status of a task's host ports whose service has published host ports"
|
||||||
|
properties:
|
||||||
|
Ports:
|
||||||
|
type: "array"
|
||||||
|
items:
|
||||||
|
$ref: "#/definitions/EndpointPortConfig"
|
||||||
|
|
||||||
|
TaskStatus:
|
||||||
|
type: "object"
|
||||||
|
description: "represents the status of a task."
|
||||||
|
properties:
|
||||||
|
Timestamp:
|
||||||
|
type: "string"
|
||||||
|
format: "dateTime"
|
||||||
|
State:
|
||||||
|
$ref: "#/definitions/TaskState"
|
||||||
|
Message:
|
||||||
|
type: "string"
|
||||||
|
Err:
|
||||||
|
type: "string"
|
||||||
|
ContainerStatus:
|
||||||
|
$ref: "#/definitions/ContainerStatus"
|
||||||
|
PortStatus:
|
||||||
|
$ref: "#/definitions/PortStatus"
|
||||||
|
|
||||||
Task:
|
Task:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
|
@ -4011,26 +4054,7 @@ definitions:
|
||||||
AssignedGenericResources:
|
AssignedGenericResources:
|
||||||
$ref: "#/definitions/GenericResources"
|
$ref: "#/definitions/GenericResources"
|
||||||
Status:
|
Status:
|
||||||
type: "object"
|
$ref: "#/definitions/TaskStatus"
|
||||||
properties:
|
|
||||||
Timestamp:
|
|
||||||
type: "string"
|
|
||||||
format: "dateTime"
|
|
||||||
State:
|
|
||||||
$ref: "#/definitions/TaskState"
|
|
||||||
Message:
|
|
||||||
type: "string"
|
|
||||||
Err:
|
|
||||||
type: "string"
|
|
||||||
ContainerStatus:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
ContainerID:
|
|
||||||
type: "string"
|
|
||||||
PID:
|
|
||||||
type: "integer"
|
|
||||||
ExitCode:
|
|
||||||
type: "integer"
|
|
||||||
DesiredState:
|
DesiredState:
|
||||||
$ref: "#/definitions/TaskState"
|
$ref: "#/definitions/TaskState"
|
||||||
JobIteration:
|
JobIteration:
|
||||||
|
@ -5613,6 +5637,28 @@ definitions:
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
example: ["--debug", "--systemd-cgroup=false"]
|
example: ["--debug", "--systemd-cgroup=false"]
|
||||||
|
status:
|
||||||
|
description: |
|
||||||
|
Information specific to the runtime.
|
||||||
|
|
||||||
|
While this API specification does not define data provided by runtimes,
|
||||||
|
the following well-known properties may be provided by runtimes:
|
||||||
|
|
||||||
|
`org.opencontainers.runtime-spec.features`: features structure as defined
|
||||||
|
in the [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec/blob/main/features.md),
|
||||||
|
in a JSON string representation.
|
||||||
|
|
||||||
|
<p><br /></p>
|
||||||
|
|
||||||
|
> **Note**: The information returned in this field, including the
|
||||||
|
> formatting of values and labels, should not be considered stable,
|
||||||
|
> and may change without notice.
|
||||||
|
type: "object"
|
||||||
|
x-nullable: true
|
||||||
|
additionalProperties:
|
||||||
|
type: "string"
|
||||||
|
example:
|
||||||
|
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",\"ociVersionMax\":\"1.1.0\",\"...\":\"...\"}"
|
||||||
|
|
||||||
Commit:
|
Commit:
|
||||||
description: |
|
description: |
|
||||||
|
|
|
@ -58,7 +58,7 @@ type Info struct {
|
||||||
Labels []string
|
Labels []string
|
||||||
ExperimentalBuild bool
|
ExperimentalBuild bool
|
||||||
ServerVersion string
|
ServerVersion string
|
||||||
Runtimes map[string]Runtime
|
Runtimes map[string]RuntimeWithStatus
|
||||||
DefaultRuntime string
|
DefaultRuntime string
|
||||||
Swarm swarm.Info
|
Swarm swarm.Info
|
||||||
// LiveRestoreEnabled determines whether containers should be kept
|
// LiveRestoreEnabled determines whether containers should be kept
|
||||||
|
|
|
@ -12,3 +12,9 @@ type Runtime struct {
|
||||||
Type string `json:"runtimeType,omitempty"`
|
Type string `json:"runtimeType,omitempty"`
|
||||||
Options map[string]interface{} `json:"options,omitempty"`
|
Options map[string]interface{} `json:"options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RuntimeWithStatus extends [Runtime] to hold [RuntimeStatus].
|
||||||
|
type RuntimeWithStatus struct {
|
||||||
|
Runtime
|
||||||
|
Status map[string]string `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|
|
@ -77,6 +77,8 @@ type ImageInspect struct {
|
||||||
// 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.
|
||||||
//
|
//
|
||||||
// Depending on how the image was created, this field may be empty.
|
// Depending on how the image was created, this field may be empty.
|
||||||
|
//
|
||||||
|
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
||||||
Container string
|
Container string
|
||||||
|
|
||||||
// ContainerConfig is an optional field containing the configuration of the
|
// ContainerConfig is an optional field containing the configuration of the
|
||||||
|
@ -84,6 +86,8 @@ type ImageInspect struct {
|
||||||
//
|
//
|
||||||
// Previous versions of Docker builder used this field to store build cache,
|
// Previous versions of Docker builder used this field to store build cache,
|
||||||
// and it is not in active use anymore.
|
// and it is not in active use anymore.
|
||||||
|
//
|
||||||
|
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
||||||
ContainerConfig *container.Config
|
ContainerConfig *container.Config
|
||||||
|
|
||||||
// DockerVersion is the version of Docker that was used to build the image.
|
// DockerVersion is the version of Docker that was used to build the image.
|
||||||
|
|
|
@ -6,17 +6,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
"go.opentelemetry.io/otel/propagation"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// postHijacked sends a POST request and hijacks the connection.
|
// postHijacked sends a POST request and hijacks the connection.
|
||||||
|
@ -54,33 +50,16 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn,
|
||||||
req.Header.Set("Connection", "Upgrade")
|
req.Header.Set("Connection", "Upgrade")
|
||||||
req.Header.Set("Upgrade", proto)
|
req.Header.Set("Upgrade", proto)
|
||||||
|
|
||||||
// We aren't using the configured RoundTripper here so manually inject the trace context
|
|
||||||
tp := cli.tp
|
|
||||||
if tp == nil {
|
|
||||||
if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() {
|
|
||||||
tp = span.TracerProvider()
|
|
||||||
} else {
|
|
||||||
tp = otel.GetTracerProvider()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, span := tp.Tracer("").Start(ctx, req.Method+" "+req.URL.Path, trace.WithSpanKind(trace.SpanKindClient))
|
|
||||||
// FIXME(thaJeztah): httpconv.ClientRequest is now an internal package; replace this with alternative for semconv v1.21
|
|
||||||
// span.SetAttributes(httpconv.ClientRequest(req)...)
|
|
||||||
defer func() {
|
|
||||||
if retErr != nil {
|
|
||||||
span.RecordError(retErr)
|
|
||||||
span.SetStatus(codes.Error, retErr.Error())
|
|
||||||
}
|
|
||||||
span.End()
|
|
||||||
}()
|
|
||||||
otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(req.Header))
|
|
||||||
|
|
||||||
dialer := cli.Dialer()
|
dialer := cli.Dialer()
|
||||||
conn, err := dialer(ctx)
|
conn, err := dialer(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", errors.Wrap(err, "cannot connect to the Docker daemon. Is 'docker daemon' running on this host?")
|
return nil, "", errors.Wrap(err, "cannot connect to the Docker daemon. Is 'docker daemon' running on this host?")
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if retErr != nil {
|
||||||
|
conn.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// When we set up a TCP connection for hijack, there could be long periods
|
// When we set up a TCP connection for hijack, there could be long periods
|
||||||
// of inactivity (a long running command with no output) that in certain
|
// of inactivity (a long running command with no output) that in certain
|
||||||
|
@ -92,37 +71,10 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn,
|
||||||
_ = tcpConn.SetKeepAlivePeriod(30 * time.Second)
|
_ = tcpConn.SetKeepAlivePeriod(30 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
clientconn := httputil.NewClientConn(conn, nil)
|
hc := &hijackedConn{conn, bufio.NewReader(conn)}
|
||||||
defer clientconn.Close()
|
|
||||||
|
|
||||||
// Server hijacks the connection, error 'connection closed' expected
|
// Server hijacks the connection, error 'connection closed' expected
|
||||||
resp, err := clientconn.Do(req)
|
resp, err := otelhttp.NewTransport(hc).RoundTrip(req)
|
||||||
if resp != nil {
|
|
||||||
// This is a simplified variant of "httpconv.ClientStatus(resp.StatusCode))";
|
|
||||||
//
|
|
||||||
// The main purpose of httpconv.ClientStatus() is to detect whether the
|
|
||||||
// status was successful (1xx, 2xx, 3xx) or non-successful (4xx/5xx).
|
|
||||||
//
|
|
||||||
// It also provides complex logic to *validate* status-codes against
|
|
||||||
// a hard-coded list meant to exclude "bogus" status codes in "success"
|
|
||||||
// ranges (1xx, 2xx) and convert them into an error status. That code
|
|
||||||
// seemed over-reaching (and not accounting for potential future valid
|
|
||||||
// status codes). We assume we only get valid status codes, and only
|
|
||||||
// look at status-code ranges.
|
|
||||||
//
|
|
||||||
// For reference, see:
|
|
||||||
// https://github.com/open-telemetry/opentelemetry-go/blob/v1.21.0/semconv/v1.17.0/httpconv/http.go#L85-L89
|
|
||||||
// https://github.com/open-telemetry/opentelemetry-go/blob/v1.21.0/semconv/internal/v2/http.go#L322-L330
|
|
||||||
// https://github.com/open-telemetry/opentelemetry-go/blob/v1.21.0/semconv/internal/v2/http.go#L356-L404
|
|
||||||
code := codes.Unset
|
|
||||||
if resp.StatusCode >= http.StatusBadRequest {
|
|
||||||
code = codes.Error
|
|
||||||
}
|
|
||||||
span.SetStatus(code, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
//nolint:staticcheck // ignore SA1019 for connecting to old (pre go1.8) daemons
|
|
||||||
if err != httputil.ErrPersistEOF {
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
@ -130,20 +82,18 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn,
|
||||||
_ = resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
|
return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
c, br := clientconn.Hijack()
|
if hc.r.Buffered() > 0 {
|
||||||
if br.Buffered() > 0 {
|
|
||||||
// If there is buffered content, wrap the connection. We return an
|
// If there is buffered content, wrap the connection. We return an
|
||||||
// object that implements CloseWrite if the underlying connection
|
// object that implements CloseWrite if the underlying connection
|
||||||
// implements it.
|
// implements it.
|
||||||
if _, ok := c.(types.CloseWriter); ok {
|
if _, ok := hc.Conn.(types.CloseWriter); ok {
|
||||||
c = &hijackedConnCloseWriter{&hijackedConn{c, br}}
|
conn = &hijackedConnCloseWriter{hc}
|
||||||
} else {
|
} else {
|
||||||
c = &hijackedConn{c, br}
|
conn = hc
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
br.Reset(nil)
|
hc.r.Reset(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
var mediaType string
|
var mediaType string
|
||||||
|
@ -152,7 +102,7 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn,
|
||||||
mediaType = resp.Header.Get("Content-Type")
|
mediaType = resp.Header.Get("Content-Type")
|
||||||
}
|
}
|
||||||
|
|
||||||
return c, mediaType, nil
|
return conn, mediaType, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// hijackedConn wraps a net.Conn and is returned by setupHijackConn in the case
|
// hijackedConn wraps a net.Conn and is returned by setupHijackConn in the case
|
||||||
|
@ -164,6 +114,13 @@ type hijackedConn struct {
|
||||||
r *bufio.Reader
|
r *bufio.Reader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *hijackedConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
if err := req.Write(c.Conn); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return http.ReadResponse(c.r, req)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *hijackedConn) Read(b []byte) (int, error) {
|
func (c *hijackedConn) Read(b []byte) (int, error) {
|
||||||
return c.r.Read(b)
|
return c.r.Read(b)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,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.0-beta.2.0.20231213091442-f3cc93630ed8+incompatible
|
# github.com/docker/docker v25.0.0-beta.2.0.20231219173513-388216fc45ab+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
|
||||||
|
|
Loading…
Reference in New Issue