mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-16 16:37:10 +08:00
vendor: update buildkit to 539be170
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
1
vendor/github.com/docker/docker/api/common_unix.go
generated
vendored
1
vendor/github.com/docker/docker/api/common_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package api // import "github.com/docker/docker/api"
|
||||
|
490
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
490
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
@ -382,11 +382,13 @@ definitions:
|
||||
type: "string"
|
||||
description: |
|
||||
- Empty string means not to restart
|
||||
- `no` Do not automatically restart
|
||||
- `always` Always restart
|
||||
- `unless-stopped` Restart always except when the user has manually stopped the container
|
||||
- `on-failure` Restart only when the container exit code is non-zero
|
||||
enum:
|
||||
- ""
|
||||
- "no"
|
||||
- "always"
|
||||
- "unless-stopped"
|
||||
- "on-failure"
|
||||
@ -744,6 +746,7 @@ definitions:
|
||||
description: |
|
||||
Health stores information about the container's healthcheck results.
|
||||
type: "object"
|
||||
x-nullable: true
|
||||
properties:
|
||||
Status:
|
||||
description: |
|
||||
@ -769,13 +772,13 @@ definitions:
|
||||
description: |
|
||||
Log contains the last few results (oldest first)
|
||||
items:
|
||||
x-nullable: true
|
||||
$ref: "#/definitions/HealthcheckResult"
|
||||
|
||||
HealthcheckResult:
|
||||
description: |
|
||||
HealthcheckResult stores information about a single run of a healthcheck probe
|
||||
type: "object"
|
||||
x-nullable: true
|
||||
properties:
|
||||
Start:
|
||||
description: |
|
||||
@ -2188,6 +2191,25 @@ definitions:
|
||||
type: "string"
|
||||
x-nullable: false
|
||||
|
||||
PluginPrivilege:
|
||||
description: |
|
||||
Describes a permission the user has to accept upon installing
|
||||
the plugin.
|
||||
type: "object"
|
||||
x-go-name: "PluginPrivilege"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
example: "network"
|
||||
Description:
|
||||
type: "string"
|
||||
Value:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
example:
|
||||
- "host"
|
||||
|
||||
Plugin:
|
||||
description: "A plugin for the Engine API"
|
||||
type: "object"
|
||||
@ -2970,19 +2992,7 @@ definitions:
|
||||
PluginPrivilege:
|
||||
type: "array"
|
||||
items:
|
||||
description: |
|
||||
Describes a permission accepted by the user upon installing the
|
||||
plugin.
|
||||
type: "object"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
Description:
|
||||
type: "string"
|
||||
Value:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
$ref: "#/definitions/PluginPrivilege"
|
||||
ContainerSpec:
|
||||
type: "object"
|
||||
description: |
|
||||
@ -4022,73 +4032,71 @@ definitions:
|
||||
Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
|
||||
|
||||
ContainerSummary:
|
||||
type: "array"
|
||||
items:
|
||||
type: "object"
|
||||
properties:
|
||||
Id:
|
||||
description: "The ID of this container"
|
||||
type: "object"
|
||||
properties:
|
||||
Id:
|
||||
description: "The ID of this container"
|
||||
type: "string"
|
||||
x-go-name: "ID"
|
||||
Names:
|
||||
description: "The names that this container has been given"
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
x-go-name: "ID"
|
||||
Names:
|
||||
description: "The names that this container has been given"
|
||||
type: "array"
|
||||
items:
|
||||
Image:
|
||||
description: "The name of the image used when creating this container"
|
||||
type: "string"
|
||||
ImageID:
|
||||
description: "The ID of the image that this container was created from"
|
||||
type: "string"
|
||||
Command:
|
||||
description: "Command to run when starting the container"
|
||||
type: "string"
|
||||
Created:
|
||||
description: "When the container was created"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
Ports:
|
||||
description: "The ports exposed by this container"
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Port"
|
||||
SizeRw:
|
||||
description: "The size of files that have been created or changed by this container"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
SizeRootFs:
|
||||
description: "The total size of all the files in this container"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
Labels:
|
||||
description: "User-defined key/value metadata."
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
State:
|
||||
description: "The state of this container (e.g. `Exited`)"
|
||||
type: "string"
|
||||
Status:
|
||||
description: "Additional human-readable status of this container (e.g. `Exit 0`)"
|
||||
type: "string"
|
||||
HostConfig:
|
||||
type: "object"
|
||||
properties:
|
||||
NetworkMode:
|
||||
type: "string"
|
||||
Image:
|
||||
description: "The name of the image used when creating this container"
|
||||
type: "string"
|
||||
ImageID:
|
||||
description: "The ID of the image that this container was created from"
|
||||
type: "string"
|
||||
Command:
|
||||
description: "Command to run when starting the container"
|
||||
type: "string"
|
||||
Created:
|
||||
description: "When the container was created"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
Ports:
|
||||
description: "The ports exposed by this container"
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Port"
|
||||
SizeRw:
|
||||
description: "The size of files that have been created or changed by this container"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
SizeRootFs:
|
||||
description: "The total size of all the files in this container"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
Labels:
|
||||
description: "User-defined key/value metadata."
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
State:
|
||||
description: "The state of this container (e.g. `Exited`)"
|
||||
type: "string"
|
||||
Status:
|
||||
description: "Additional human-readable status of this container (e.g. `Exit 0`)"
|
||||
type: "string"
|
||||
HostConfig:
|
||||
type: "object"
|
||||
properties:
|
||||
NetworkMode:
|
||||
type: "string"
|
||||
NetworkSettings:
|
||||
description: "A summary of the container's network settings"
|
||||
type: "object"
|
||||
properties:
|
||||
Networks:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
$ref: "#/definitions/EndpointSettings"
|
||||
Mounts:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Mount"
|
||||
NetworkSettings:
|
||||
description: "A summary of the container's network settings"
|
||||
type: "object"
|
||||
properties:
|
||||
Networks:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
$ref: "#/definitions/EndpointSettings"
|
||||
Mounts:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Mount"
|
||||
|
||||
Driver:
|
||||
description: "Driver represents a driver (network, logging, secrets)."
|
||||
@ -4210,6 +4218,7 @@ definitions:
|
||||
ContainerState stores container's running state. It's part of ContainerJSONBase
|
||||
and will be returned by the "inspect" command.
|
||||
type: "object"
|
||||
x-nullable: true
|
||||
properties:
|
||||
Status:
|
||||
description: |
|
||||
@ -4267,7 +4276,6 @@ definitions:
|
||||
type: "string"
|
||||
example: "2020-01-06T09:07:59.461876391Z"
|
||||
Health:
|
||||
x-nullable: true
|
||||
$ref: "#/definitions/Health"
|
||||
|
||||
SystemVersion:
|
||||
@ -4366,7 +4374,6 @@ definitions:
|
||||
type: "string"
|
||||
example: "2020-06-22T15:49:27.000000000+00:00"
|
||||
|
||||
|
||||
SystemInfo:
|
||||
type: "object"
|
||||
properties:
|
||||
@ -5199,6 +5206,158 @@ definitions:
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
|
||||
EventActor:
|
||||
description: |
|
||||
Actor describes something that generates events, like a container, network,
|
||||
or a volume.
|
||||
type: "object"
|
||||
properties:
|
||||
ID:
|
||||
description: "The ID of the object emitting the event"
|
||||
type: "string"
|
||||
example: "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743"
|
||||
Attributes:
|
||||
description: |
|
||||
Various key/value attributes of the object, depending on its type.
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
com.example.some-label: "some-label-value"
|
||||
image: "alpine:latest"
|
||||
name: "my-container"
|
||||
|
||||
EventMessage:
|
||||
description: |
|
||||
EventMessage represents the information an event contains.
|
||||
type: "object"
|
||||
title: "SystemEventsResponse"
|
||||
properties:
|
||||
Type:
|
||||
description: "The type of object emitting the event"
|
||||
type: "string"
|
||||
enum: ["builder", "config", "container", "daemon", "image", "network", "node", "plugin", "secret", "service", "volume"]
|
||||
example: "container"
|
||||
Action:
|
||||
description: "The type of event"
|
||||
type: "string"
|
||||
example: "create"
|
||||
Actor:
|
||||
$ref: "#/definitions/EventActor"
|
||||
scope:
|
||||
description: |
|
||||
Scope of the event. Engine events are `local` scope. Cluster (Swarm)
|
||||
events are `swarm` scope.
|
||||
type: "string"
|
||||
enum: ["local", "swarm"]
|
||||
time:
|
||||
description: "Timestamp of event"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
example: 1629574695
|
||||
timeNano:
|
||||
description: "Timestamp of event, with nanosecond accuracy"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
example: 1629574695515050031
|
||||
|
||||
OCIDescriptor:
|
||||
type: "object"
|
||||
x-go-name: Descriptor
|
||||
description: |
|
||||
A descriptor struct containing digest, media type, and size, as defined in
|
||||
the [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).
|
||||
properties:
|
||||
mediaType:
|
||||
description: |
|
||||
The media type of the object this schema refers to.
|
||||
type: "string"
|
||||
example: "application/vnd.docker.distribution.manifest.v2+json"
|
||||
digest:
|
||||
description: |
|
||||
The digest of the targeted content.
|
||||
type: "string"
|
||||
example: "sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96"
|
||||
size:
|
||||
description: |
|
||||
The size in bytes of the blob.
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
example: 3987495
|
||||
# TODO Not yet including these fields for now, as they are nil / omitted in our response.
|
||||
# urls:
|
||||
# description: |
|
||||
# List of URLs from which this object MAY be downloaded.
|
||||
# type: "array"
|
||||
# items:
|
||||
# type: "string"
|
||||
# format: "uri"
|
||||
# annotations:
|
||||
# description: |
|
||||
# Arbitrary metadata relating to the targeted content.
|
||||
# type: "object"
|
||||
# additionalProperties:
|
||||
# type: "string"
|
||||
# platform:
|
||||
# $ref: "#/definitions/OCIPlatform"
|
||||
|
||||
OCIPlatform:
|
||||
type: "object"
|
||||
x-go-name: Platform
|
||||
description: |
|
||||
Describes the platform which the image in the manifest runs on, as defined
|
||||
in the [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md).
|
||||
properties:
|
||||
architecture:
|
||||
description: |
|
||||
The CPU architecture, for example `amd64` or `ppc64`.
|
||||
type: "string"
|
||||
example: "arm"
|
||||
os:
|
||||
description: |
|
||||
The operating system, for example `linux` or `windows`.
|
||||
type: "string"
|
||||
example: "windows"
|
||||
os.version:
|
||||
description: |
|
||||
Optional field specifying the operating system version, for example on
|
||||
Windows `10.0.19041.1165`.
|
||||
type: "string"
|
||||
example: "10.0.19041.1165"
|
||||
os.features:
|
||||
description: |
|
||||
Optional field specifying an array of strings, each listing a required
|
||||
OS feature (for example on Windows `win32k`).
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
example:
|
||||
- "win32k"
|
||||
variant:
|
||||
description: |
|
||||
Optional field specifying a variant of the CPU, for example `v7` to
|
||||
specify ARMv7 when architecture is `arm`.
|
||||
type: "string"
|
||||
example: "v7"
|
||||
|
||||
DistributionInspect:
|
||||
type: "object"
|
||||
x-go-name: DistributionInspect
|
||||
title: "DistributionInspectResponse"
|
||||
required: [Descriptor, Platforms]
|
||||
description: |
|
||||
Describes the result obtained from contacting the registry to retrieve
|
||||
image metadata.
|
||||
properties:
|
||||
Descriptor:
|
||||
$ref: "#/definitions/OCIDescriptor"
|
||||
Platforms:
|
||||
type: "array"
|
||||
description: |
|
||||
An array containing all platforms supported by the image.
|
||||
items:
|
||||
$ref: "#/definitions/OCIPlatform"
|
||||
|
||||
paths:
|
||||
/containers/json:
|
||||
get:
|
||||
@ -5261,7 +5420,9 @@ paths:
|
||||
200:
|
||||
description: "no error"
|
||||
schema:
|
||||
$ref: "#/definitions/ContainerSummary"
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/ContainerSummary"
|
||||
examples:
|
||||
application/json:
|
||||
- Id: "8dfafdbc3a40"
|
||||
@ -5627,7 +5788,6 @@ paths:
|
||||
items:
|
||||
type: "string"
|
||||
State:
|
||||
x-nullable: true
|
||||
$ref: "#/definitions/ContainerState"
|
||||
Image:
|
||||
description: "The container's image ID"
|
||||
@ -7505,6 +7665,18 @@ paths:
|
||||
Refer to the [authentication section](#section/Authentication) for
|
||||
details.
|
||||
type: "string"
|
||||
- name: "changes"
|
||||
in: "query"
|
||||
description: |
|
||||
Apply `Dockerfile` instructions to the image that is created,
|
||||
for example: `changes=ENV DEBUG=true`.
|
||||
Note that `ENV DEBUG=true` should be URI component encoded.
|
||||
|
||||
Supported `Dockerfile` instructions:
|
||||
`CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
- name: "platform"
|
||||
in: "query"
|
||||
description: "Platform in the format os[/arch[/variant]]"
|
||||
@ -8179,44 +8351,7 @@ paths:
|
||||
200:
|
||||
description: "no error"
|
||||
schema:
|
||||
type: "object"
|
||||
title: "SystemEventsResponse"
|
||||
properties:
|
||||
Type:
|
||||
description: "The type of object emitting the event"
|
||||
type: "string"
|
||||
Action:
|
||||
description: "The type of event"
|
||||
type: "string"
|
||||
Actor:
|
||||
type: "object"
|
||||
properties:
|
||||
ID:
|
||||
description: "The ID of the object emitting the event"
|
||||
type: "string"
|
||||
Attributes:
|
||||
description: "Various key/value attributes of the object, depending on its type"
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
time:
|
||||
description: "Timestamp of event"
|
||||
type: "integer"
|
||||
timeNano:
|
||||
description: "Timestamp of event, with nanosecond accuracy"
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
examples:
|
||||
application/json:
|
||||
Type: "container"
|
||||
Action: "create"
|
||||
Actor:
|
||||
ID: "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743"
|
||||
Attributes:
|
||||
com.example.some-label: "some-label-value"
|
||||
image: "alpine"
|
||||
name: "my-container"
|
||||
time: 1461943101
|
||||
$ref: "#/definitions/EventMessage"
|
||||
400:
|
||||
description: "bad parameter"
|
||||
schema:
|
||||
@ -8531,6 +8666,7 @@ paths:
|
||||
description: "Exec configuration"
|
||||
schema:
|
||||
type: "object"
|
||||
title: "ExecConfig"
|
||||
properties:
|
||||
AttachStdin:
|
||||
type: "boolean"
|
||||
@ -8621,6 +8757,7 @@ paths:
|
||||
in: "body"
|
||||
schema:
|
||||
type: "object"
|
||||
title: "ExecStartConfig"
|
||||
properties:
|
||||
Detach:
|
||||
type: "boolean"
|
||||
@ -9155,6 +9292,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
type: "object"
|
||||
title: "NetworkCreateRequest"
|
||||
required: ["Name"]
|
||||
properties:
|
||||
Name:
|
||||
@ -9265,6 +9403,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
type: "object"
|
||||
title: "NetworkConnectRequest"
|
||||
properties:
|
||||
Container:
|
||||
type: "string"
|
||||
@ -9311,6 +9450,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
type: "object"
|
||||
title: "NetworkDisconnectRequest"
|
||||
properties:
|
||||
Container:
|
||||
type: "string"
|
||||
@ -9395,20 +9535,7 @@ paths:
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
description: |
|
||||
Describes a permission the user has to accept upon installing
|
||||
the plugin.
|
||||
type: "object"
|
||||
title: "PluginPrivilegeItem"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
Description:
|
||||
type: "string"
|
||||
Value:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
$ref: "#/definitions/PluginPrivilege"
|
||||
example:
|
||||
- Name: "network"
|
||||
Description: ""
|
||||
@ -9484,19 +9611,7 @@ paths:
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
description: |
|
||||
Describes a permission accepted by the user upon installing the
|
||||
plugin.
|
||||
type: "object"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
Description:
|
||||
type: "string"
|
||||
Value:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
$ref: "#/definitions/PluginPrivilege"
|
||||
example:
|
||||
- Name: "network"
|
||||
Description: ""
|
||||
@ -9668,19 +9783,7 @@ paths:
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
description: |
|
||||
Describes a permission accepted by the user upon installing the
|
||||
plugin.
|
||||
type: "object"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
Description:
|
||||
type: "string"
|
||||
Value:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
$ref: "#/definitions/PluginPrivilege"
|
||||
example:
|
||||
- Name: "network"
|
||||
Description: ""
|
||||
@ -9970,6 +10073,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
type: "object"
|
||||
title: "SwarmInitRequest"
|
||||
properties:
|
||||
ListenAddr:
|
||||
description: |
|
||||
@ -10068,6 +10172,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
type: "object"
|
||||
title: "SwarmJoinRequest"
|
||||
properties:
|
||||
ListenAddr:
|
||||
description: |
|
||||
@ -10228,6 +10333,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
type: "object"
|
||||
title: "SwarmUnlockRequest"
|
||||
properties:
|
||||
UnlockKey:
|
||||
description: "The swarm's unlock key."
|
||||
@ -11339,67 +11445,7 @@ paths:
|
||||
200:
|
||||
description: "descriptor and platform information"
|
||||
schema:
|
||||
type: "object"
|
||||
x-go-name: DistributionInspect
|
||||
title: "DistributionInspectResponse"
|
||||
required: [Descriptor, Platforms]
|
||||
properties:
|
||||
Descriptor:
|
||||
type: "object"
|
||||
description: |
|
||||
A descriptor struct containing digest, media type, and size.
|
||||
properties:
|
||||
MediaType:
|
||||
type: "string"
|
||||
Size:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
Digest:
|
||||
type: "string"
|
||||
URLs:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
Platforms:
|
||||
type: "array"
|
||||
description: |
|
||||
An array containing all platforms supported by the image.
|
||||
items:
|
||||
type: "object"
|
||||
properties:
|
||||
Architecture:
|
||||
type: "string"
|
||||
OS:
|
||||
type: "string"
|
||||
OSVersion:
|
||||
type: "string"
|
||||
OSFeatures:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
Variant:
|
||||
type: "string"
|
||||
Features:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
examples:
|
||||
application/json:
|
||||
Descriptor:
|
||||
MediaType: "application/vnd.docker.distribution.manifest.v2+json"
|
||||
Digest: "sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96"
|
||||
Size: 3987495
|
||||
URLs:
|
||||
- ""
|
||||
Platforms:
|
||||
- Architecture: "amd64"
|
||||
OS: "linux"
|
||||
OSVersion: ""
|
||||
OSFeatures:
|
||||
- ""
|
||||
Variant: ""
|
||||
Features:
|
||||
- ""
|
||||
$ref: "#/definitions/DistributionInspect"
|
||||
401:
|
||||
description: "Failed authentication or no image found"
|
||||
schema:
|
||||
|
69
vendor/github.com/docker/docker/api/types/container/host_config.go
generated
vendored
69
vendor/github.com/docker/docker/api/types/container/host_config.go
generated
vendored
@ -13,19 +13,26 @@ import (
|
||||
// CgroupnsMode represents the cgroup namespace mode of the container
|
||||
type CgroupnsMode string
|
||||
|
||||
// cgroup namespace modes for containers
|
||||
const (
|
||||
CgroupnsModeEmpty CgroupnsMode = ""
|
||||
CgroupnsModePrivate CgroupnsMode = "private"
|
||||
CgroupnsModeHost CgroupnsMode = "host"
|
||||
)
|
||||
|
||||
// IsPrivate indicates whether the container uses its own private cgroup namespace
|
||||
func (c CgroupnsMode) IsPrivate() bool {
|
||||
return c == "private"
|
||||
return c == CgroupnsModePrivate
|
||||
}
|
||||
|
||||
// IsHost indicates whether the container shares the host's cgroup namespace
|
||||
func (c CgroupnsMode) IsHost() bool {
|
||||
return c == "host"
|
||||
return c == CgroupnsModeHost
|
||||
}
|
||||
|
||||
// IsEmpty indicates whether the container cgroup namespace mode is unset
|
||||
func (c CgroupnsMode) IsEmpty() bool {
|
||||
return c == ""
|
||||
return c == CgroupnsModeEmpty
|
||||
}
|
||||
|
||||
// Valid indicates whether the cgroup namespace mode is valid
|
||||
@ -37,60 +44,69 @@ func (c CgroupnsMode) Valid() bool {
|
||||
// values are platform specific
|
||||
type Isolation string
|
||||
|
||||
// Isolation modes for containers
|
||||
const (
|
||||
IsolationEmpty Isolation = "" // IsolationEmpty is unspecified (same behavior as default)
|
||||
IsolationDefault Isolation = "default" // IsolationDefault is the default isolation mode on current daemon
|
||||
IsolationProcess Isolation = "process" // IsolationProcess is process isolation mode
|
||||
IsolationHyperV Isolation = "hyperv" // IsolationHyperV is HyperV isolation mode
|
||||
)
|
||||
|
||||
// IsDefault indicates the default isolation technology of a container. On Linux this
|
||||
// is the native driver. On Windows, this is a Windows Server Container.
|
||||
func (i Isolation) IsDefault() bool {
|
||||
return strings.ToLower(string(i)) == "default" || string(i) == ""
|
||||
// TODO consider making isolation-mode strict (case-sensitive)
|
||||
v := Isolation(strings.ToLower(string(i)))
|
||||
return v == IsolationDefault || v == IsolationEmpty
|
||||
}
|
||||
|
||||
// IsHyperV indicates the use of a Hyper-V partition for isolation
|
||||
func (i Isolation) IsHyperV() bool {
|
||||
return strings.ToLower(string(i)) == "hyperv"
|
||||
// TODO consider making isolation-mode strict (case-sensitive)
|
||||
return Isolation(strings.ToLower(string(i))) == IsolationHyperV
|
||||
}
|
||||
|
||||
// IsProcess indicates the use of process isolation
|
||||
func (i Isolation) IsProcess() bool {
|
||||
return strings.ToLower(string(i)) == "process"
|
||||
// TODO consider making isolation-mode strict (case-sensitive)
|
||||
return Isolation(strings.ToLower(string(i))) == IsolationProcess
|
||||
}
|
||||
|
||||
const (
|
||||
// IsolationEmpty is unspecified (same behavior as default)
|
||||
IsolationEmpty = Isolation("")
|
||||
// IsolationDefault is the default isolation mode on current daemon
|
||||
IsolationDefault = Isolation("default")
|
||||
// IsolationProcess is process isolation mode
|
||||
IsolationProcess = Isolation("process")
|
||||
// IsolationHyperV is HyperV isolation mode
|
||||
IsolationHyperV = Isolation("hyperv")
|
||||
)
|
||||
|
||||
// IpcMode represents the container ipc stack.
|
||||
type IpcMode string
|
||||
|
||||
// IpcMode constants
|
||||
const (
|
||||
IPCModeNone IpcMode = "none"
|
||||
IPCModeHost IpcMode = "host"
|
||||
IPCModeContainer IpcMode = "container"
|
||||
IPCModePrivate IpcMode = "private"
|
||||
IPCModeShareable IpcMode = "shareable"
|
||||
)
|
||||
|
||||
// IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared.
|
||||
func (n IpcMode) IsPrivate() bool {
|
||||
return n == "private"
|
||||
return n == IPCModePrivate
|
||||
}
|
||||
|
||||
// IsHost indicates whether the container shares the host's ipc namespace.
|
||||
func (n IpcMode) IsHost() bool {
|
||||
return n == "host"
|
||||
return n == IPCModeHost
|
||||
}
|
||||
|
||||
// IsShareable indicates whether the container's ipc namespace can be shared with another container.
|
||||
func (n IpcMode) IsShareable() bool {
|
||||
return n == "shareable"
|
||||
return n == IPCModeShareable
|
||||
}
|
||||
|
||||
// IsContainer indicates whether the container uses another container's ipc namespace.
|
||||
func (n IpcMode) IsContainer() bool {
|
||||
parts := strings.SplitN(string(n), ":", 2)
|
||||
return len(parts) > 1 && parts[0] == "container"
|
||||
return strings.HasPrefix(string(n), string(IPCModeContainer)+":")
|
||||
}
|
||||
|
||||
// IsNone indicates whether container IpcMode is set to "none".
|
||||
func (n IpcMode) IsNone() bool {
|
||||
return n == "none"
|
||||
return n == IPCModeNone
|
||||
}
|
||||
|
||||
// IsEmpty indicates whether container IpcMode is empty
|
||||
@ -105,9 +121,8 @@ func (n IpcMode) Valid() bool {
|
||||
|
||||
// Container returns the name of the container ipc stack is going to be used.
|
||||
func (n IpcMode) Container() string {
|
||||
parts := strings.SplitN(string(n), ":", 2)
|
||||
if len(parts) > 1 && parts[0] == "container" {
|
||||
return parts[1]
|
||||
if n.IsContainer() {
|
||||
return strings.TrimPrefix(string(n), string(IPCModeContainer)+":")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@ -326,7 +341,7 @@ type LogMode string
|
||||
|
||||
// Available logging modes
|
||||
const (
|
||||
LogModeUnset = ""
|
||||
LogModeUnset LogMode = ""
|
||||
LogModeBlocking LogMode = "blocking"
|
||||
LogModeNonBlock LogMode = "non-blocking"
|
||||
)
|
||||
|
1
vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
generated
vendored
1
vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package container // import "github.com/docker/docker/api/types/container"
|
||||
|
47
vendor/github.com/docker/docker/api/types/events/events.go
generated
vendored
47
vendor/github.com/docker/docker/api/types/events/events.go
generated
vendored
@ -1,33 +1,26 @@
|
||||
package events // import "github.com/docker/docker/api/types/events"
|
||||
|
||||
// Type is used for event-types.
|
||||
type Type = string
|
||||
|
||||
// List of known event types.
|
||||
const (
|
||||
// BuilderEventType is the event type that the builder generates
|
||||
BuilderEventType = "builder"
|
||||
// ContainerEventType is the event type that containers generate
|
||||
ContainerEventType = "container"
|
||||
// DaemonEventType is the event type that daemon generate
|
||||
DaemonEventType = "daemon"
|
||||
// ImageEventType is the event type that images generate
|
||||
ImageEventType = "image"
|
||||
// NetworkEventType is the event type that networks generate
|
||||
NetworkEventType = "network"
|
||||
// PluginEventType is the event type that plugins generate
|
||||
PluginEventType = "plugin"
|
||||
// VolumeEventType is the event type that volumes generate
|
||||
VolumeEventType = "volume"
|
||||
// ServiceEventType is the event type that services generate
|
||||
ServiceEventType = "service"
|
||||
// NodeEventType is the event type that nodes generate
|
||||
NodeEventType = "node"
|
||||
// SecretEventType is the event type that secrets generate
|
||||
SecretEventType = "secret"
|
||||
// ConfigEventType is the event type that configs generate
|
||||
ConfigEventType = "config"
|
||||
BuilderEventType Type = "builder" // BuilderEventType is the event type that the builder generates.
|
||||
ConfigEventType Type = "config" // ConfigEventType is the event type that configs generate.
|
||||
ContainerEventType Type = "container" // ContainerEventType is the event type that containers generate.
|
||||
DaemonEventType Type = "daemon" // DaemonEventType is the event type that daemon generate.
|
||||
ImageEventType Type = "image" // ImageEventType is the event type that images generate.
|
||||
NetworkEventType Type = "network" // NetworkEventType is the event type that networks generate.
|
||||
NodeEventType Type = "node" // NodeEventType is the event type that nodes generate.
|
||||
PluginEventType Type = "plugin" // PluginEventType is the event type that plugins generate.
|
||||
SecretEventType Type = "secret" // SecretEventType is the event type that secrets generate.
|
||||
ServiceEventType Type = "service" // ServiceEventType is the event type that services generate.
|
||||
VolumeEventType Type = "volume" // VolumeEventType is the event type that volumes generate.
|
||||
)
|
||||
|
||||
// Actor describes something that generates events,
|
||||
// like a container, or a network, or a volume.
|
||||
// It has a defined name and a set or attributes.
|
||||
// It has a defined name and a set of attributes.
|
||||
// The container attributes are its labels, other actors
|
||||
// can generate these attributes from other properties.
|
||||
type Actor struct {
|
||||
@ -39,11 +32,11 @@ type Actor struct {
|
||||
type Message struct {
|
||||
// Deprecated information from JSONMessage.
|
||||
// With data only in container events.
|
||||
Status string `json:"status,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
From string `json:"from,omitempty"`
|
||||
Status string `json:"status,omitempty"` // Deprecated: use Action instead.
|
||||
ID string `json:"id,omitempty"` // Deprecated: use Actor.ID instead.
|
||||
From string `json:"from,omitempty"` // Deprecated: use Actor.Attributes["image"] instead.
|
||||
|
||||
Type string
|
||||
Type Type
|
||||
Action string
|
||||
Actor Actor
|
||||
// Engine events are local scope. Cluster events are swarm scope.
|
||||
|
3
vendor/github.com/docker/docker/api/types/versions/compare.go
generated
vendored
3
vendor/github.com/docker/docker/api/types/versions/compare.go
generated
vendored
@ -8,6 +8,9 @@ import (
|
||||
// compare compares two version strings
|
||||
// returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise.
|
||||
func compare(v1, v2 string) int {
|
||||
if v1 == v2 {
|
||||
return 0
|
||||
}
|
||||
var (
|
||||
currTab = strings.Split(v1, ".")
|
||||
otherTab = strings.Split(v2, ".")
|
||||
|
15
vendor/github.com/docker/docker/client/client.go
generated
vendored
15
vendor/github.com/docker/docker/client/client.go
generated
vendored
@ -281,21 +281,6 @@ func ParseHostURL(host string) (*url.URL, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CustomHTTPHeaders returns the custom http headers stored by the client.
|
||||
func (cli *Client) CustomHTTPHeaders() map[string]string {
|
||||
m := make(map[string]string)
|
||||
for k, v := range cli.customHTTPHeaders {
|
||||
m[k] = v
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// SetCustomHTTPHeaders that will be set on every HTTP request made by the client.
|
||||
// Deprecated: use WithHTTPHeaders when creating the client.
|
||||
func (cli *Client) SetCustomHTTPHeaders(headers map[string]string) {
|
||||
cli.customHTTPHeaders = headers
|
||||
}
|
||||
|
||||
// Dialer returns a dialer for a raw stream connection, with HTTP/1.1 header, that can be used for proxying the daemon connection.
|
||||
// Used by `docker dial-stdio` (docker/cli#889).
|
||||
func (cli *Client) Dialer() func(context.Context) (net.Conn, error) {
|
||||
|
1
vendor/github.com/docker/docker/client/client_unix.go
generated
vendored
1
vendor/github.com/docker/docker/client/client_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build linux || freebsd || openbsd || netbsd || darwin || solaris || illumos || dragonfly
|
||||
// +build linux freebsd openbsd netbsd darwin solaris illumos dragonfly
|
||||
|
||||
package client // import "github.com/docker/docker/client"
|
||||
|
4
vendor/github.com/docker/docker/client/config_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/config_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
)
|
||||
@ -23,7 +23,7 @@ func (cli *Client) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.C
|
||||
return swarm.Config{}, nil, wrapResponseError(err, resp, "config", id)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.body)
|
||||
body, err := io.ReadAll(resp.body)
|
||||
if err != nil {
|
||||
return swarm.Config{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/container_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/container_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -41,7 +41,7 @@ func (cli *Client) ContainerInspectWithRaw(ctx context.Context, containerID stri
|
||||
return types.ContainerJSON{}, nil, wrapResponseError(err, serverResp, "container", containerID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(serverResp.body)
|
||||
body, err := io.ReadAll(serverResp.body)
|
||||
if err != nil {
|
||||
return types.ContainerJSON{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/image_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/image_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
)
|
||||
@ -20,7 +20,7 @@ func (cli *Client) ImageInspectWithRaw(ctx context.Context, imageID string) (typ
|
||||
return types.ImageInspect{}, nil, wrapResponseError(err, serverResp, "image", imageID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(serverResp.body)
|
||||
body, err := io.ReadAll(serverResp.body)
|
||||
if err != nil {
|
||||
return types.ImageInspect{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/network_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/network_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -39,7 +39,7 @@ func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string,
|
||||
return networkResource, nil, wrapResponseError(err, resp, "network", networkID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.body)
|
||||
body, err := io.ReadAll(resp.body)
|
||||
if err != nil {
|
||||
return networkResource, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/node_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/node_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
)
|
||||
@ -20,7 +20,7 @@ func (cli *Client) NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm
|
||||
return swarm.Node{}, nil, wrapResponseError(err, serverResp, "node", nodeID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(serverResp.body)
|
||||
body, err := io.ReadAll(serverResp.body)
|
||||
if err != nil {
|
||||
return swarm.Node{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/plugin_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/plugin_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
)
|
||||
@ -20,7 +20,7 @@ func (cli *Client) PluginInspectWithRaw(ctx context.Context, name string) (*type
|
||||
return nil, nil, wrapResponseError(err, resp, "plugin", name)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.body)
|
||||
body, err := io.ReadAll(resp.body)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
5
vendor/github.com/docker/docker/client/request.go
generated
vendored
5
vendor/github.com/docker/docker/client/request.go
generated
vendored
@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -206,7 +205,7 @@ func (cli *Client) checkResponseErr(serverResp serverResponse) error {
|
||||
R: serverResp.body,
|
||||
N: int64(bodyMax),
|
||||
}
|
||||
body, err = ioutil.ReadAll(bodyR)
|
||||
body, err = io.ReadAll(bodyR)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -266,7 +265,7 @@ func encodeData(data interface{}) (*bytes.Buffer, error) {
|
||||
func ensureReaderClosed(response serverResponse) {
|
||||
if response.body != nil {
|
||||
// Drain up to 512 bytes and close the body to let the Transport reuse the connection
|
||||
io.CopyN(ioutil.Discard, response.body, 512)
|
||||
io.CopyN(io.Discard, response.body, 512)
|
||||
response.body.Close()
|
||||
}
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/secret_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/secret_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
)
|
||||
@ -23,7 +23,7 @@ func (cli *Client) SecretInspectWithRaw(ctx context.Context, id string) (swarm.S
|
||||
return swarm.Secret{}, nil, wrapResponseError(err, resp, "secret", id)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.body)
|
||||
body, err := io.ReadAll(resp.body)
|
||||
if err != nil {
|
||||
return swarm.Secret{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/service_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/service_inspect.go
generated
vendored
@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -25,7 +25,7 @@ func (cli *Client) ServiceInspectWithRaw(ctx context.Context, serviceID string,
|
||||
return swarm.Service{}, nil, wrapResponseError(err, serverResp, "service", serviceID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(serverResp.body)
|
||||
body, err := io.ReadAll(serverResp.body)
|
||||
if err != nil {
|
||||
return swarm.Service{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/task_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/task_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
)
|
||||
@ -20,7 +20,7 @@ func (cli *Client) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm
|
||||
return swarm.Task{}, nil, wrapResponseError(err, serverResp, "task", taskID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(serverResp.body)
|
||||
body, err := io.ReadAll(serverResp.body)
|
||||
if err != nil {
|
||||
return swarm.Task{}, nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/docker/client/volume_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/volume_inspect.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
)
|
||||
@ -28,7 +28,7 @@ func (cli *Client) VolumeInspectWithRaw(ctx context.Context, volumeID string) (t
|
||||
return volume, nil, wrapResponseError(err, resp, "volume", volumeID)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.body)
|
||||
body, err := io.ReadAll(resp.body)
|
||||
if err != nil {
|
||||
return volume, nil, err
|
||||
}
|
||||
|
6
vendor/github.com/docker/docker/errdefs/http_helpers.go
generated
vendored
6
vendor/github.com/docker/docker/errdefs/http_helpers.go
generated
vendored
@ -100,10 +100,10 @@ func FromStatusCode(err error, statusCode int) error {
|
||||
err = System(err)
|
||||
}
|
||||
default:
|
||||
logrus.WithFields(logrus.Fields{
|
||||
logrus.WithError(err).WithFields(logrus.Fields{
|
||||
"module": "api",
|
||||
"status_code": fmt.Sprintf("%d", statusCode),
|
||||
}).Debugf("FIXME: Got an status-code for which error does not match any expected type!!!: %d", statusCode)
|
||||
"status_code": statusCode,
|
||||
}).Debug("FIXME: Got an status-code for which error does not match any expected type!!!")
|
||||
|
||||
switch {
|
||||
case statusCode >= 200 && statusCode < 400:
|
||||
|
88
vendor/github.com/docker/docker/pkg/archive/archive.go
generated
vendored
88
vendor/github.com/docker/docker/pkg/archive/archive.go
generated
vendored
@ -7,9 +7,9 @@ import (
|
||||
"compress/bzip2"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@ -23,6 +23,7 @@ import (
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/klauspost/compress/zstd"
|
||||
"github.com/sirupsen/logrus"
|
||||
exec "golang.org/x/sys/execabs"
|
||||
)
|
||||
@ -84,6 +85,8 @@ const (
|
||||
Gzip
|
||||
// Xz is xz compression algorithm.
|
||||
Xz
|
||||
// Zstd is zstd compression algorithm.
|
||||
Zstd
|
||||
)
|
||||
|
||||
const (
|
||||
@ -122,14 +125,59 @@ func IsArchivePath(path string) bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
const (
|
||||
zstdMagicSkippableStart = 0x184D2A50
|
||||
zstdMagicSkippableMask = 0xFFFFFFF0
|
||||
)
|
||||
|
||||
var (
|
||||
bzip2Magic = []byte{0x42, 0x5A, 0x68}
|
||||
gzipMagic = []byte{0x1F, 0x8B, 0x08}
|
||||
xzMagic = []byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}
|
||||
zstdMagic = []byte{0x28, 0xb5, 0x2f, 0xfd}
|
||||
)
|
||||
|
||||
type matcher = func([]byte) bool
|
||||
|
||||
func magicNumberMatcher(m []byte) matcher {
|
||||
return func(source []byte) bool {
|
||||
return bytes.HasPrefix(source, m)
|
||||
}
|
||||
}
|
||||
|
||||
// zstdMatcher detects zstd compression algorithm.
|
||||
// Zstandard compressed data is made of one or more frames.
|
||||
// There are two frame formats defined by Zstandard: Zstandard frames and Skippable frames.
|
||||
// See https://tools.ietf.org/id/draft-kucherawy-dispatch-zstd-00.html#rfc.section.2 for more details.
|
||||
func zstdMatcher() matcher {
|
||||
return func(source []byte) bool {
|
||||
if bytes.HasPrefix(source, zstdMagic) {
|
||||
// Zstandard frame
|
||||
return true
|
||||
}
|
||||
// skippable frame
|
||||
if len(source) < 8 {
|
||||
return false
|
||||
}
|
||||
// magic number from 0x184D2A50 to 0x184D2A5F.
|
||||
if binary.LittleEndian.Uint32(source[:4])&zstdMagicSkippableMask == zstdMagicSkippableStart {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// DetectCompression detects the compression algorithm of the source.
|
||||
func DetectCompression(source []byte) Compression {
|
||||
for compression, m := range map[Compression][]byte{
|
||||
Bzip2: {0x42, 0x5A, 0x68},
|
||||
Gzip: {0x1F, 0x8B, 0x08},
|
||||
Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00},
|
||||
} {
|
||||
if bytes.HasPrefix(source, m) {
|
||||
compressionMap := map[Compression]matcher{
|
||||
Bzip2: magicNumberMatcher(bzip2Magic),
|
||||
Gzip: magicNumberMatcher(gzipMagic),
|
||||
Xz: magicNumberMatcher(xzMagic),
|
||||
Zstd: zstdMatcher(),
|
||||
}
|
||||
for _, compression := range []Compression{Bzip2, Gzip, Xz, Zstd} {
|
||||
fn := compressionMap[compression]
|
||||
if fn(source) {
|
||||
return compression
|
||||
}
|
||||
}
|
||||
@ -216,6 +264,13 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
|
||||
}
|
||||
readBufWrapper := p.NewReadCloserWrapper(buf, xzReader)
|
||||
return wrapReadCloser(readBufWrapper, cancel), nil
|
||||
case Zstd:
|
||||
zstdReader, err := zstd.NewReader(buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
readBufWrapper := p.NewReadCloserWrapper(buf, zstdReader)
|
||||
return readBufWrapper, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension())
|
||||
}
|
||||
@ -342,6 +397,8 @@ func (compression *Compression) Extension() string {
|
||||
return "tar.gz"
|
||||
case Xz:
|
||||
return "tar.xz"
|
||||
case Zstd:
|
||||
return "tar.zst"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@ -809,8 +866,8 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
||||
rebaseName := options.RebaseNames[include]
|
||||
|
||||
var (
|
||||
parentMatched []bool
|
||||
parentDirs []string
|
||||
parentMatchInfo []fileutils.MatchInfo
|
||||
parentDirs []string
|
||||
)
|
||||
|
||||
walkRoot := getWalkRoot(srcPath, include)
|
||||
@ -845,13 +902,14 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
||||
break
|
||||
}
|
||||
parentDirs = parentDirs[:len(parentDirs)-1]
|
||||
parentMatched = parentMatched[:len(parentMatched)-1]
|
||||
parentMatchInfo = parentMatchInfo[:len(parentMatchInfo)-1]
|
||||
}
|
||||
|
||||
if len(parentMatched) != 0 {
|
||||
skip, err = pm.MatchesUsingParentResult(relFilePath, parentMatched[len(parentMatched)-1])
|
||||
var matchInfo fileutils.MatchInfo
|
||||
if len(parentMatchInfo) != 0 {
|
||||
skip, matchInfo, err = pm.MatchesUsingParentResults(relFilePath, parentMatchInfo[len(parentMatchInfo)-1])
|
||||
} else {
|
||||
skip, err = pm.MatchesOrParentMatches(relFilePath)
|
||||
skip, matchInfo, err = pm.MatchesUsingParentResults(relFilePath, fileutils.MatchInfo{})
|
||||
}
|
||||
if err != nil {
|
||||
logrus.Errorf("Error matching %s: %v", relFilePath, err)
|
||||
@ -860,7 +918,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
||||
|
||||
if f.IsDir() {
|
||||
parentDirs = append(parentDirs, relFilePath)
|
||||
parentMatched = append(parentMatched, skip)
|
||||
parentMatchInfo = append(parentMatchInfo, matchInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1284,7 +1342,7 @@ func cmdStream(cmd *exec.Cmd, input io.Reader) (io.ReadCloser, error) {
|
||||
// of that file as an archive. The archive can only be read once - as soon as reading completes,
|
||||
// the file will be deleted.
|
||||
func NewTempArchive(src io.Reader, dir string) (*TempArchive, error) {
|
||||
f, err := ioutil.TempFile(dir, "")
|
||||
f, err := os.CreateTemp(dir, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
1
vendor/github.com/docker/docker/pkg/archive/archive_other.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/archive/archive_other.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package archive // import "github.com/docker/docker/pkg/archive"
|
||||
|
1
vendor/github.com/docker/docker/pkg/archive/archive_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/archive/archive_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package archive // import "github.com/docker/docker/pkg/archive"
|
||||
|
3
vendor/github.com/docker/docker/pkg/archive/changes.go
generated
vendored
3
vendor/github.com/docker/docker/pkg/archive/changes.go
generated
vendored
@ -5,7 +5,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@ -348,7 +347,7 @@ func ChangesDirs(newDir, oldDir string) ([]Change, error) {
|
||||
oldRoot, newRoot *FileInfo
|
||||
)
|
||||
if oldDir == "" {
|
||||
emptyDir, err := ioutil.TempDir("", "empty")
|
||||
emptyDir, err := os.MkdirTemp("", "empty")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
1
vendor/github.com/docker/docker/pkg/archive/changes_other.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/archive/changes_other.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package archive // import "github.com/docker/docker/pkg/archive"
|
||||
|
1
vendor/github.com/docker/docker/pkg/archive/changes_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/archive/changes_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package archive // import "github.com/docker/docker/pkg/archive"
|
||||
|
3
vendor/github.com/docker/docker/pkg/archive/copy.go
generated
vendored
3
vendor/github.com/docker/docker/pkg/archive/copy.go
generated
vendored
@ -4,7 +4,6 @@ import (
|
||||
"archive/tar"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -261,7 +260,7 @@ func PrepareArchiveCopy(srcContent io.Reader, srcInfo, dstInfo CopyInfo) (dstDir
|
||||
// The destination exists as a directory. No alteration
|
||||
// to srcContent is needed as its contents can be
|
||||
// simply extracted to the destination directory.
|
||||
return dstInfo.Path, ioutil.NopCloser(srcContent), nil
|
||||
return dstInfo.Path, io.NopCloser(srcContent), nil
|
||||
case dstInfo.Exists && srcInfo.IsDir:
|
||||
// The destination exists as some type of file and the source
|
||||
// content is a directory. This is an error condition since
|
||||
|
1
vendor/github.com/docker/docker/pkg/archive/copy_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/archive/copy_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package archive // import "github.com/docker/docker/pkg/archive"
|
||||
|
3
vendor/github.com/docker/docker/pkg/archive/diff.go
generated
vendored
3
vendor/github.com/docker/docker/pkg/archive/diff.go
generated
vendored
@ -4,7 +4,6 @@ import (
|
||||
"archive/tar"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@ -100,7 +99,7 @@ func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64,
|
||||
basename := filepath.Base(hdr.Name)
|
||||
aufsHardlinks[basename] = hdr
|
||||
if aufsTempdir == "" {
|
||||
if aufsTempdir, err = ioutil.TempDir("", "dockerplnk"); err != nil {
|
||||
if aufsTempdir, err = os.MkdirTemp("", "dockerplnk"); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
defer os.RemoveAll(aufsTempdir)
|
||||
|
1
vendor/github.com/docker/docker/pkg/archive/time_unsupported.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/archive/time_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package archive // import "github.com/docker/docker/pkg/archive"
|
||||
|
107
vendor/github.com/docker/docker/pkg/fileutils/fileutils.go
generated
vendored
107
vendor/github.com/docker/docker/pkg/fileutils/fileutils.go
generated
vendored
@ -9,8 +9,30 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/scanner"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// escapeBytes is a bitmap used to check whether a character should be escaped when creating the regex.
|
||||
var escapeBytes [8]byte
|
||||
|
||||
// shouldEscape reports whether a rune should be escaped as part of the regex.
|
||||
//
|
||||
// This only includes characters that require escaping in regex but are also NOT valid filepath pattern characters.
|
||||
// Additionally, '\' is not excluded because there is specific logic to properly handle this, as it's a path separator
|
||||
// on Windows.
|
||||
//
|
||||
// Adapted from regexp::QuoteMeta in go stdlib.
|
||||
// See https://cs.opensource.google/go/go/+/refs/tags/go1.17.2:src/regexp/regexp.go;l=703-715;drc=refs%2Ftags%2Fgo1.17.2
|
||||
func shouldEscape(b rune) bool {
|
||||
return b < utf8.RuneSelf && escapeBytes[b%8]&(1<<(b/8)) != 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
for _, b := range []byte(`.+()|{}$`) {
|
||||
escapeBytes[b%8] |= 1 << (b / 8)
|
||||
}
|
||||
}
|
||||
|
||||
// PatternMatcher allows checking paths against a list of patterns
|
||||
type PatternMatcher struct {
|
||||
patterns []*Pattern
|
||||
@ -62,9 +84,9 @@ func NewPatternMatcher(patterns []string) (*PatternMatcher, error) {
|
||||
//
|
||||
// Matches is not safe to call concurrently.
|
||||
//
|
||||
// This implementation is buggy (it only checks a single parent dir against the
|
||||
// pattern) and will be removed soon. Use either MatchesOrParentMatches or
|
||||
// MatchesUsingParentResult instead.
|
||||
// Deprecated: This implementation is buggy (it only checks a single parent dir
|
||||
// against the pattern) and will be removed soon. Use either
|
||||
// MatchesOrParentMatches or MatchesUsingParentResults instead.
|
||||
func (pm *PatternMatcher) Matches(file string) (bool, error) {
|
||||
matched := false
|
||||
file = filepath.FromSlash(file)
|
||||
@ -150,6 +172,11 @@ func (pm *PatternMatcher) MatchesOrParentMatches(file string) (bool, error) {
|
||||
// The "file" argument should be a slash-delimited path.
|
||||
//
|
||||
// MatchesUsingParentResult is not safe to call concurrently.
|
||||
//
|
||||
// Deprecated: this function does behave correctly in some cases (see
|
||||
// https://github.com/docker/buildx/issues/850).
|
||||
//
|
||||
// Use MatchesUsingParentResults instead.
|
||||
func (pm *PatternMatcher) MatchesUsingParentResult(file string, parentMatched bool) (bool, error) {
|
||||
matched := parentMatched
|
||||
file = filepath.FromSlash(file)
|
||||
@ -174,6 +201,78 @@ func (pm *PatternMatcher) MatchesUsingParentResult(file string, parentMatched bo
|
||||
return matched, nil
|
||||
}
|
||||
|
||||
// MatchInfo tracks information about parent dir matches while traversing a
|
||||
// filesystem.
|
||||
type MatchInfo struct {
|
||||
parentMatched []bool
|
||||
}
|
||||
|
||||
// MatchesUsingParentResults returns true if "file" matches any of the patterns
|
||||
// and isn't excluded by any of the subsequent patterns. The functionality is
|
||||
// the same as Matches, but as an optimization, the caller passes in
|
||||
// intermediate results from matching the parent directory.
|
||||
//
|
||||
// The "file" argument should be a slash-delimited path.
|
||||
//
|
||||
// MatchesUsingParentResults is not safe to call concurrently.
|
||||
func (pm *PatternMatcher) MatchesUsingParentResults(file string, parentMatchInfo MatchInfo) (bool, MatchInfo, error) {
|
||||
parentMatched := parentMatchInfo.parentMatched
|
||||
if len(parentMatched) != 0 && len(parentMatched) != len(pm.patterns) {
|
||||
return false, MatchInfo{}, errors.New("wrong number of values in parentMatched")
|
||||
}
|
||||
|
||||
file = filepath.FromSlash(file)
|
||||
matched := false
|
||||
|
||||
matchInfo := MatchInfo{
|
||||
parentMatched: make([]bool, len(pm.patterns)),
|
||||
}
|
||||
for i, pattern := range pm.patterns {
|
||||
match := false
|
||||
// If the parent matched this pattern, we don't need to recheck.
|
||||
if len(parentMatched) != 0 {
|
||||
match = parentMatched[i]
|
||||
}
|
||||
|
||||
if !match {
|
||||
// Skip evaluation if this is an inclusion and the filename
|
||||
// already matched the pattern, or it's an exclusion and it has
|
||||
// not matched the pattern yet.
|
||||
if pattern.exclusion != matched {
|
||||
continue
|
||||
}
|
||||
|
||||
var err error
|
||||
match, err = pattern.match(file)
|
||||
if err != nil {
|
||||
return false, matchInfo, err
|
||||
}
|
||||
|
||||
// If the zero value of MatchInfo was passed in, we don't have
|
||||
// any information about the parent dir's match results, and we
|
||||
// apply the same logic as MatchesOrParentMatches.
|
||||
if !match && len(parentMatched) == 0 {
|
||||
if parentPath := filepath.Dir(file); parentPath != "." {
|
||||
parentPathDirs := strings.Split(parentPath, string(os.PathSeparator))
|
||||
// Check to see if the pattern matches one of our parent dirs.
|
||||
for i := range parentPathDirs {
|
||||
match, _ = pattern.match(strings.Join(parentPathDirs[:i+1], string(os.PathSeparator)))
|
||||
if match {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
matchInfo.parentMatched[i] = match
|
||||
|
||||
if match {
|
||||
matched = !pattern.exclusion
|
||||
}
|
||||
}
|
||||
return matched, matchInfo, nil
|
||||
}
|
||||
|
||||
// Exclusions returns true if any of the patterns define exclusions
|
||||
func (pm *PatternMatcher) Exclusions() bool {
|
||||
return pm.exclusions
|
||||
@ -256,7 +355,7 @@ func (p *Pattern) compile() error {
|
||||
} else if ch == '?' {
|
||||
// "?" is any char except "/"
|
||||
regStr += "[^" + escSL + "]"
|
||||
} else if ch == '.' || ch == '$' {
|
||||
} else if shouldEscape(ch) {
|
||||
// Escape some regexp special chars that have no meaning
|
||||
// in golang's filepath.Match
|
||||
regStr += `\` + string(ch)
|
||||
|
4
vendor/github.com/docker/docker/pkg/fileutils/fileutils_unix.go
generated
vendored
4
vendor/github.com/docker/docker/pkg/fileutils/fileutils_unix.go
generated
vendored
@ -1,10 +1,10 @@
|
||||
//go:build linux || freebsd
|
||||
// +build linux freebsd
|
||||
|
||||
package fileutils // import "github.com/docker/docker/pkg/fileutils"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -13,7 +13,7 @@ import (
|
||||
// GetTotalUsedFds Returns the number of used File Descriptors by
|
||||
// reading it via /proc filesystem.
|
||||
func GetTotalUsedFds() int {
|
||||
if fds, err := ioutil.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil {
|
||||
if fds, err := os.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil {
|
||||
logrus.Errorf("Error opening /proc/%d/fd: %s", os.Getpid(), err)
|
||||
} else {
|
||||
return len(fds)
|
||||
|
1
vendor/github.com/docker/docker/pkg/homedir/homedir_others.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/homedir/homedir_others.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package homedir // import "github.com/docker/docker/pkg/homedir"
|
||||
|
1
vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package homedir // import "github.com/docker/docker/pkg/homedir"
|
||||
|
1
vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package idtools // import "github.com/docker/docker/pkg/idtools"
|
||||
|
1
vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/idtools/usergroupadd_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package idtools // import "github.com/docker/docker/pkg/idtools"
|
||||
|
1
vendor/github.com/docker/docker/pkg/idtools/utils_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/idtools/utils_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package idtools // import "github.com/docker/docker/pkg/idtools"
|
||||
|
14
vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go
generated
vendored
14
vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go
generated
vendored
@ -50,12 +50,12 @@ func NewBytesPipe() *BytesPipe {
|
||||
// It can allocate new []byte slices in a process of writing.
|
||||
func (bp *BytesPipe) Write(p []byte) (int, error) {
|
||||
bp.mu.Lock()
|
||||
defer bp.mu.Unlock()
|
||||
|
||||
written := 0
|
||||
loop0:
|
||||
for {
|
||||
if bp.closeErr != nil {
|
||||
bp.mu.Unlock()
|
||||
return written, ErrClosed
|
||||
}
|
||||
|
||||
@ -72,7 +72,6 @@ loop0:
|
||||
// errBufferFull is an error we expect to get if the buffer is full
|
||||
if err != nil && err != errBufferFull {
|
||||
bp.wait.Broadcast()
|
||||
bp.mu.Unlock()
|
||||
return written, err
|
||||
}
|
||||
|
||||
@ -100,7 +99,6 @@ loop0:
|
||||
bp.buf = append(bp.buf, getBuffer(nextCap))
|
||||
}
|
||||
bp.wait.Broadcast()
|
||||
bp.mu.Unlock()
|
||||
return written, nil
|
||||
}
|
||||
|
||||
@ -126,17 +124,14 @@ func (bp *BytesPipe) Close() error {
|
||||
// Data could be read only once.
|
||||
func (bp *BytesPipe) Read(p []byte) (n int, err error) {
|
||||
bp.mu.Lock()
|
||||
defer bp.mu.Unlock()
|
||||
if bp.bufLen == 0 {
|
||||
if bp.closeErr != nil {
|
||||
err := bp.closeErr
|
||||
bp.mu.Unlock()
|
||||
return 0, err
|
||||
return 0, bp.closeErr
|
||||
}
|
||||
bp.wait.Wait()
|
||||
if bp.bufLen == 0 && bp.closeErr != nil {
|
||||
err := bp.closeErr
|
||||
bp.mu.Unlock()
|
||||
return 0, err
|
||||
return 0, bp.closeErr
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +156,6 @@ func (bp *BytesPipe) Read(p []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
bp.wait.Broadcast()
|
||||
bp.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
|
5
vendor/github.com/docker/docker/pkg/ioutils/fswriters.go
generated
vendored
5
vendor/github.com/docker/docker/pkg/ioutils/fswriters.go
generated
vendored
@ -2,7 +2,6 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils"
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
@ -11,7 +10,7 @@ import (
|
||||
// temporary file and closing it atomically changes the temporary file to
|
||||
// destination path. Writing and closing concurrently is not allowed.
|
||||
func NewAtomicFileWriter(filename string, perm os.FileMode) (io.WriteCloser, error) {
|
||||
f, err := ioutil.TempFile(filepath.Dir(filename), ".tmp-"+filepath.Base(filename))
|
||||
f, err := os.CreateTemp(filepath.Dir(filename), ".tmp-"+filepath.Base(filename))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -94,7 +93,7 @@ type AtomicWriteSet struct {
|
||||
// commit. If no temporary directory is given the system
|
||||
// default is used.
|
||||
func NewAtomicWriteSet(tmpDir string) (*AtomicWriteSet, error) {
|
||||
td, err := ioutil.TempDir(tmpDir, "write-set-")
|
||||
td, err := os.MkdirTemp(tmpDir, "write-set-")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
16
vendor/github.com/docker/docker/pkg/ioutils/readers.go
generated
vendored
16
vendor/github.com/docker/docker/pkg/ioutils/readers.go
generated
vendored
@ -2,9 +2,12 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
|
||||
// make sure crypto.SHA256, crypto.sha512 and crypto.SHA384 are registered
|
||||
// TODO remove once https://github.com/opencontainers/go-digest/pull/64 is merged.
|
||||
_ "crypto/sha256"
|
||||
_ "crypto/sha512"
|
||||
)
|
||||
|
||||
// ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser
|
||||
@ -49,15 +52,6 @@ func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader {
|
||||
}
|
||||
}
|
||||
|
||||
// HashData returns the sha256 sum of src.
|
||||
func HashData(src io.Reader) (string, error) {
|
||||
h := sha256.New()
|
||||
if _, err := io.Copy(h, src); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil
|
||||
}
|
||||
|
||||
// OnEOFReader wraps an io.ReadCloser and a function
|
||||
// the function will run at the end of file or close the file.
|
||||
type OnEOFReader struct {
|
||||
|
7
vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go
generated
vendored
7
vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go
generated
vendored
@ -1,10 +1,11 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package ioutils // import "github.com/docker/docker/pkg/ioutils"
|
||||
|
||||
import "io/ioutil"
|
||||
import "os"
|
||||
|
||||
// TempDir on Unix systems is equivalent to ioutil.TempDir.
|
||||
// TempDir on Unix systems is equivalent to os.MkdirTemp.
|
||||
func TempDir(dir, prefix string) (string, error) {
|
||||
return ioutil.TempDir(dir, prefix)
|
||||
return os.MkdirTemp(dir, prefix)
|
||||
}
|
||||
|
6
vendor/github.com/docker/docker/pkg/ioutils/temp_windows.go
generated
vendored
6
vendor/github.com/docker/docker/pkg/ioutils/temp_windows.go
generated
vendored
@ -1,14 +1,14 @@
|
||||
package ioutils // import "github.com/docker/docker/pkg/ioutils"
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/pkg/longpath"
|
||||
)
|
||||
|
||||
// TempDir is the equivalent of ioutil.TempDir, except that the result is in Windows longpath format.
|
||||
// TempDir is the equivalent of os.MkdirTemp, except that the result is in Windows longpath format.
|
||||
func TempDir(dir, prefix string) (string, error) {
|
||||
tempDir, err := ioutil.TempDir(dir, prefix)
|
||||
tempDir, err := os.MkdirTemp(dir, prefix)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
6
vendor/github.com/docker/docker/pkg/namesgenerator/names-generator.go
generated
vendored
6
vendor/github.com/docker/docker/pkg/namesgenerator/names-generator.go
generated
vendored
@ -1,8 +1,8 @@
|
||||
package namesgenerator // import "github.com/docker/docker/pkg/namesgenerator"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -840,13 +840,13 @@ var (
|
||||
// integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
|
||||
func GetRandomName(retry int) string {
|
||||
begin:
|
||||
name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand)
|
||||
name := left[rand.Intn(len(left))] + "_" + right[rand.Intn(len(right))] //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand)
|
||||
if name == "boring_wozniak" /* Steve Wozniak is not boring */ {
|
||||
goto begin
|
||||
}
|
||||
|
||||
if retry > 0 {
|
||||
name = fmt.Sprintf("%s%d", name, rand.Intn(10)) //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand)
|
||||
name += strconv.Itoa(rand.Intn(10)) //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand)
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/chtimes_nowindows.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/chtimes_nowindows.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
4
vendor/github.com/docker/docker/pkg/system/filesys_unix.go
generated
vendored
4
vendor/github.com/docker/docker/pkg/system/filesys_unix.go
generated
vendored
@ -1,9 +1,9 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
@ -63,5 +63,5 @@ func OpenFileSequential(name string, flag int, perm os.FileMode) (*os.File, erro
|
||||
// to find the pathname of the file. It is the caller's responsibility
|
||||
// to remove the file when no longer needed.
|
||||
func TempFileSequential(dir, prefix string) (f *os.File, err error) {
|
||||
return ioutil.TempFile(dir, prefix)
|
||||
return os.CreateTemp(dir, prefix)
|
||||
}
|
||||
|
2
vendor/github.com/docker/docker/pkg/system/filesys_windows.go
generated
vendored
2
vendor/github.com/docker/docker/pkg/system/filesys_windows.go
generated
vendored
@ -258,7 +258,7 @@ func nextSuffix() string {
|
||||
return strconv.Itoa(int(1e9 + r%1e9))[1:]
|
||||
}
|
||||
|
||||
// TempFileSequential is a copy of ioutil.TempFile, modified to use sequential
|
||||
// TempFileSequential is a copy of os.CreateTemp, modified to use sequential
|
||||
// file access. Below is the original comment from golang:
|
||||
// TempFile creates a new temporary file in the directory dir
|
||||
// with a name beginning with prefix, opens the file for reading
|
||||
|
21
vendor/github.com/docker/docker/pkg/system/init_windows.go
generated
vendored
21
vendor/github.com/docker/docker/pkg/system/init_windows.go
generated
vendored
@ -1,29 +1,18 @@
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
// containerdRuntimeSupported determines if ContainerD should be the runtime.
|
||||
// As of March 2019, this is an experimental feature.
|
||||
// containerdRuntimeSupported determines if containerd should be the runtime.
|
||||
containerdRuntimeSupported = false
|
||||
)
|
||||
|
||||
// InitContainerdRuntime sets whether to use ContainerD for runtime
|
||||
// on Windows. This is an experimental feature still in development, and
|
||||
// also requires an environment variable to be set (so as not to turn the
|
||||
// feature on from simply experimental which would also mean LCOW.
|
||||
func InitContainerdRuntime(experimental bool, cdPath string) {
|
||||
if experimental && len(cdPath) > 0 && len(os.Getenv("DOCKER_WINDOWS_CONTAINERD_RUNTIME")) > 0 {
|
||||
logrus.Warnf("Using ContainerD runtime. This feature is experimental")
|
||||
// InitContainerdRuntime sets whether to use containerd for runtime on Windows.
|
||||
func InitContainerdRuntime(cdPath string) {
|
||||
if len(cdPath) > 0 {
|
||||
containerdRuntimeSupported = true
|
||||
}
|
||||
}
|
||||
|
||||
// ContainerdRuntimeSupported returns true if the use of ContainerD runtime is supported.
|
||||
// ContainerdRuntimeSupported returns true if the use of containerd runtime is supported.
|
||||
func ContainerdRuntimeSupported() bool {
|
||||
return containerdRuntimeSupported
|
||||
}
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/lstat_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/lstat_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/meminfo_unsupported.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/meminfo_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux && !windows
|
||||
// +build !linux,!windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
7
vendor/github.com/docker/docker/pkg/system/mknod.go
generated
vendored
7
vendor/github.com/docker/docker/pkg/system/mknod.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
@ -6,12 +7,6 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Mknod creates a filesystem node (file, device special file or named pipe) named path
|
||||
// with attributes specified by mode and dev.
|
||||
func Mknod(path string, mode uint32, dev int) error {
|
||||
return unix.Mknod(path, mode, dev)
|
||||
}
|
||||
|
||||
// Mkdev is used to build the value of linux devices (in /dev/) which specifies major
|
||||
// and minor number of the newly created device special file.
|
||||
// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes.
|
||||
|
14
vendor/github.com/docker/docker/pkg/system/mknod_freebsd.go
generated
vendored
Normal file
14
vendor/github.com/docker/docker/pkg/system/mknod_freebsd.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
//go:build freebsd
|
||||
// +build freebsd
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Mknod creates a filesystem node (file, device special file or named pipe) named path
|
||||
// with attributes specified by mode and dev.
|
||||
func Mknod(path string, mode uint32, dev int) error {
|
||||
return unix.Mknod(path, mode, uint64(dev))
|
||||
}
|
14
vendor/github.com/docker/docker/pkg/system/mknod_unix.go
generated
vendored
Normal file
14
vendor/github.com/docker/docker/pkg/system/mknod_unix.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
//go:build !freebsd && !windows
|
||||
// +build !freebsd,!windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Mknod creates a filesystem node (file, device special file or named pipe) named path
|
||||
// with attributes specified by mode and dev.
|
||||
func Mknod(path string, mode uint32, dev int) error {
|
||||
return unix.Mknod(path, mode, dev)
|
||||
}
|
1
vendor/github.com/docker/docker/pkg/system/path_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/path_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
5
vendor/github.com/docker/docker/pkg/system/process_unix.go
generated
vendored
5
vendor/github.com/docker/docker/pkg/system/process_unix.go
generated
vendored
@ -1,10 +1,11 @@
|
||||
//go:build linux || freebsd || darwin
|
||||
// +build linux freebsd darwin
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
@ -30,7 +31,7 @@ func KillProcess(pid int) {
|
||||
// http://man7.org/linux/man-pages/man5/proc.5.html
|
||||
func IsProcessZombie(pid int) (bool, error) {
|
||||
statPath := fmt.Sprintf("/proc/%d/stat", pid)
|
||||
dataBytes, err := ioutil.ReadFile(statPath)
|
||||
dataBytes, err := os.ReadFile(statPath)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/rm.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/rm.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !darwin && !windows
|
||||
// +build !darwin,!windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/stat_bsd.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/stat_bsd.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build freebsd || netbsd
|
||||
// +build freebsd netbsd
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/stat_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/stat_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/umask.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/umask.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/utimes_unix.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/utimes_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build linux || freebsd
|
||||
// +build linux freebsd
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/utimes_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux && !freebsd
|
||||
// +build !linux,!freebsd
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go
generated
vendored
1
vendor/github.com/docker/docker/pkg/system/xattrs_unsupported.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
1
vendor/github.com/docker/docker/registry/config_unix.go
generated
vendored
1
vendor/github.com/docker/docker/registry/config_unix.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package registry // import "github.com/docker/docker/registry"
|
||||
|
49
vendor/github.com/docker/docker/registry/endpoint_v1.go
generated
vendored
49
vendor/github.com/docker/docker/registry/endpoint_v1.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@ -34,7 +34,8 @@ func NewV1Endpoint(index *registrytypes.IndexInfo, userAgent string, metaHeaders
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := validateEndpoint(endpoint); err != nil {
|
||||
err = validateEndpoint(endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -68,20 +69,6 @@ func validateEndpoint(endpoint *V1Endpoint) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func newV1Endpoint(address url.URL, tlsConfig *tls.Config, userAgent string, metaHeaders http.Header) *V1Endpoint {
|
||||
endpoint := &V1Endpoint{
|
||||
IsSecure: tlsConfig == nil || !tlsConfig.InsecureSkipVerify,
|
||||
URL: new(url.URL),
|
||||
}
|
||||
|
||||
*endpoint.URL = address
|
||||
|
||||
// TODO(tiborvass): make sure a ConnectTimeout transport is used
|
||||
tr := NewTransport(tlsConfig)
|
||||
endpoint.client = HTTPClient(transport.NewTransport(tr, Headers(userAgent, metaHeaders)...))
|
||||
return endpoint
|
||||
}
|
||||
|
||||
// trimV1Address trims the version off the address and returns the
|
||||
// trimmed address or an error if there is a non-V1 version.
|
||||
func trimV1Address(address string) (string, error) {
|
||||
@ -90,10 +77,7 @@ func trimV1Address(address string) (string, error) {
|
||||
apiVersionStr string
|
||||
)
|
||||
|
||||
if strings.HasSuffix(address, "/") {
|
||||
address = address[:len(address)-1]
|
||||
}
|
||||
|
||||
address = strings.TrimSuffix(address, "/")
|
||||
chunks = strings.Split(address, "/")
|
||||
apiVersionStr = chunks[len(chunks)-1]
|
||||
if apiVersionStr == "v1" {
|
||||
@ -124,9 +108,14 @@ func newV1EndpointFromStr(address string, tlsConfig *tls.Config, userAgent strin
|
||||
return nil, err
|
||||
}
|
||||
|
||||
endpoint := newV1Endpoint(*uri, tlsConfig, userAgent, metaHeaders)
|
||||
// TODO(tiborvass): make sure a ConnectTimeout transport is used
|
||||
tr := NewTransport(tlsConfig)
|
||||
|
||||
return endpoint, nil
|
||||
return &V1Endpoint{
|
||||
IsSecure: tlsConfig == nil || !tlsConfig.InsecureSkipVerify,
|
||||
URL: uri,
|
||||
client: HTTPClient(transport.NewTransport(tr, Headers(userAgent, metaHeaders)...)),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Get the formatted URL for the root of this registry Endpoint
|
||||
@ -142,29 +131,28 @@ func (e *V1Endpoint) Path(path string) string {
|
||||
|
||||
// Ping returns a PingResult which indicates whether the registry is standalone or not.
|
||||
func (e *V1Endpoint) Ping() (PingResult, error) {
|
||||
logrus.Debugf("attempting v1 ping for registry endpoint %s", e)
|
||||
|
||||
if e.String() == IndexServer {
|
||||
// Skip the check, we know this one is valid
|
||||
// (and we never want to fallback to http in case of error)
|
||||
return PingResult{Standalone: false}, nil
|
||||
return PingResult{}, nil
|
||||
}
|
||||
|
||||
logrus.Debugf("attempting v1 ping for registry endpoint %s", e)
|
||||
req, err := http.NewRequest(http.MethodGet, e.Path("_ping"), nil)
|
||||
if err != nil {
|
||||
return PingResult{Standalone: false}, err
|
||||
return PingResult{}, err
|
||||
}
|
||||
|
||||
resp, err := e.client.Do(req)
|
||||
if err != nil {
|
||||
return PingResult{Standalone: false}, err
|
||||
return PingResult{}, err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
jsonString, err := ioutil.ReadAll(resp.Body)
|
||||
jsonString, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return PingResult{Standalone: false}, fmt.Errorf("error while reading the http response: %s", err)
|
||||
return PingResult{}, fmt.Errorf("error while reading the http response: %s", err)
|
||||
}
|
||||
|
||||
// If the header is absent, we assume true for compatibility with earlier
|
||||
@ -177,13 +165,12 @@ func (e *V1Endpoint) Ping() (PingResult, error) {
|
||||
// don't stop here. Just assume sane defaults
|
||||
}
|
||||
if hdr := resp.Header.Get("X-Docker-Registry-Version"); hdr != "" {
|
||||
logrus.Debugf("Registry version header: '%s'", hdr)
|
||||
info.Version = hdr
|
||||
}
|
||||
logrus.Debugf("PingResult.Version: %q", info.Version)
|
||||
|
||||
standalone := resp.Header.Get("X-Docker-Registry-Standalone")
|
||||
logrus.Debugf("Registry standalone header: '%s'", standalone)
|
||||
|
||||
// Accepted values are "true" (case-insensitive) and "1".
|
||||
if strings.EqualFold(standalone, "true") || standalone == "1" {
|
||||
info.Standalone = true
|
||||
|
14
vendor/github.com/docker/docker/registry/registry.go
generated
vendored
14
vendor/github.com/docker/docker/registry/registry.go
generated
vendored
@ -3,9 +3,7 @@ package registry // import "github.com/docker/docker/registry"
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -18,12 +16,6 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrAlreadyExists is an error returned if an image being pushed
|
||||
// already exists on the remote side
|
||||
ErrAlreadyExists = errors.New("Image already exists")
|
||||
)
|
||||
|
||||
// HostCertsDir returns the config directory for a specific host
|
||||
func HostCertsDir(hostname string) (string, error) {
|
||||
certsDir := CertsDir()
|
||||
@ -54,7 +46,7 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
|
||||
return tlsConfig, nil
|
||||
}
|
||||
|
||||
func hasFile(files []os.FileInfo, name string) bool {
|
||||
func hasFile(files []os.DirEntry, name string) bool {
|
||||
for _, f := range files {
|
||||
if f.Name() == name {
|
||||
return true
|
||||
@ -67,7 +59,7 @@ func hasFile(files []os.FileInfo, name string) bool {
|
||||
// including roots and certificate pairs and updates the
|
||||
// provided TLS configuration.
|
||||
func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
|
||||
fs, err := ioutil.ReadDir(directory)
|
||||
fs, err := os.ReadDir(directory)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
@ -82,7 +74,7 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
|
||||
tlsConfig.RootCAs = systemPool
|
||||
}
|
||||
logrus.Debugf("crt: %s", filepath.Join(directory, f.Name()))
|
||||
data, err := ioutil.ReadFile(filepath.Join(directory, f.Name()))
|
||||
data, err := os.ReadFile(filepath.Join(directory, f.Name()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
12
vendor/github.com/docker/docker/registry/service.go
generated
vendored
12
vendor/github.com/docker/docker/registry/service.go
generated
vendored
@ -246,18 +246,12 @@ type APIEndpoint struct {
|
||||
TLSConfig *tls.Config
|
||||
}
|
||||
|
||||
// ToV1Endpoint returns a V1 API endpoint based on the APIEndpoint
|
||||
// Deprecated: this function is deprecated and will be removed in a future update
|
||||
func (e APIEndpoint) ToV1Endpoint(userAgent string, metaHeaders http.Header) *V1Endpoint {
|
||||
return newV1Endpoint(*e.URL, e.TLSConfig, userAgent, metaHeaders)
|
||||
}
|
||||
|
||||
// TLSConfig constructs a client TLS configuration based on server defaults
|
||||
func (s *DefaultService) TLSConfig(hostname string) (*tls.Config, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
return newTLSConfig(hostname, isSecureIndex(s.config, hostname))
|
||||
return s.tlsConfig(hostname)
|
||||
}
|
||||
|
||||
// tlsConfig constructs a client TLS configuration based on server defaults
|
||||
@ -265,10 +259,6 @@ func (s *DefaultService) tlsConfig(hostname string) (*tls.Config, error) {
|
||||
return newTLSConfig(hostname, isSecureIndex(s.config, hostname))
|
||||
}
|
||||
|
||||
func (s *DefaultService) tlsConfigForMirror(mirrorURL *url.URL) (*tls.Config, error) {
|
||||
return s.tlsConfig(mirrorURL.Host)
|
||||
}
|
||||
|
||||
// LookupPullEndpoints creates a list of v2 endpoints to try to pull from, in order of preference.
|
||||
// It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP.
|
||||
func (s *DefaultService) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint, err error) {
|
||||
|
2
vendor/github.com/docker/docker/registry/service_v2.go
generated
vendored
2
vendor/github.com/docker/docker/registry/service_v2.go
generated
vendored
@ -18,7 +18,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mirrorTLSConfig, err := s.tlsConfigForMirror(mirrorURL)
|
||||
mirrorTLSConfig, err := s.tlsConfig(mirrorURL.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
5
vendor/github.com/docker/docker/registry/types.go
generated
vendored
5
vendor/github.com/docker/docker/registry/types.go
generated
vendored
@ -45,9 +45,8 @@ func (av APIVersion) String() string {
|
||||
|
||||
// API Version identifiers.
|
||||
const (
|
||||
_ = iota
|
||||
APIVersion1 APIVersion = iota
|
||||
APIVersion2
|
||||
APIVersion1 APIVersion = 1
|
||||
APIVersion2 APIVersion = 2
|
||||
)
|
||||
|
||||
var apiVersions = map[APIVersion]string{
|
||||
|
Reference in New Issue
Block a user