Compare commits
133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| afdd53b4e3 | |||
| 12c309fe91 | |||
| f42719820d | |||
| 17770189de | |||
| cde0441dc8 | |||
| d9f94d5719 | |||
| 54d83fbbf4 | |||
| 30a185e936 | |||
| d43c48d5ab | |||
| 1919679638 | |||
| 6c5bc490d4 | |||
| 66558a4e64 | |||
| 0d554b549b | |||
| 8c4dc6c603 | |||
| aef1157742 | |||
| 54894f0224 | |||
| 0f109aafa8 | |||
| 89ce230bd8 | |||
| db6e494b40 | |||
| 5b3e376f86 | |||
| a47889a70f | |||
| 3c10203b39 | |||
| 9662d73735 | |||
| 35453d6c4f | |||
| 2a76b0c4e7 | |||
| 1ebaef3663 | |||
| 8a7833ab62 | |||
| 2e86812d7a | |||
| e7ca37861b | |||
| 1f8118b1cc | |||
| f2a3d50b30 | |||
| edae25f8af | |||
| d848d49be9 | |||
| 4feeefbd68 | |||
| ed223bc820 | |||
| fab55e13ce | |||
| 989b340a6c | |||
| 2fcff17544 | |||
| b74d8e1a53 | |||
| 3789f8a39e | |||
| d3485b9e9f | |||
| 613380299f | |||
| b83959e001 | |||
| 28a08a22b9 | |||
| 8e0393932b | |||
| efd052eb85 | |||
| cdd81d6559 | |||
| d9770a962e | |||
| 6efe73abe0 | |||
| d977531018 | |||
| e9f843bf04 | |||
| cfbaee4689 | |||
| daeee46977 | |||
| 08ad72160f | |||
| 3c4fe7b3e6 | |||
| 98ffe42d84 | |||
| 0d5df48121 | |||
| bf081eec36 | |||
| dc45bcc993 | |||
| 710dd00e95 | |||
| bf632329d2 | |||
| 724548bc7d | |||
| 3c6c0bce1c | |||
| 65655cc262 | |||
| 580730fce9 | |||
| 11606268f8 | |||
| 27a19966fb | |||
| a8987063b3 | |||
| b74562d917 | |||
| c0e376854b | |||
| 3bc4543f83 | |||
| 1481c8ce9a | |||
| b17b6b562d | |||
| e97c765575 | |||
| ced0996600 | |||
| 1ee40e2c74 | |||
| 40cc1d8eae | |||
| 3c2278afae | |||
| 3bd6d6902e | |||
| 05bf7fbcc8 | |||
| c6d7c0bb21 | |||
| dd08d44044 | |||
| 809975d8bd | |||
| 8b5023dd2e | |||
| 9edd9a1f2f | |||
| e93cdb6ca5 | |||
| 2a6348d1b2 | |||
| f4782b3250 | |||
| a5024666e7 | |||
| 39b2a6cc6a | |||
| 7d06f6b2f7 | |||
| 1447974b83 | |||
| 46293e97f7 | |||
| bfe2ff8208 | |||
| 380eb72940 | |||
| b407429628 | |||
| 79c42c0b97 | |||
| a96d0a526c | |||
| 5c5c50d717 | |||
| 4bf11b7562 | |||
| 224c7dbec4 | |||
| e25d5c64c5 | |||
| 419e94df4a | |||
| 3713ee1eea | |||
| 2d5f041bde | |||
| 520e3600ee | |||
| fad718c7ea | |||
| cd68c8f003 | |||
| 05fabe63ba | |||
| 0a2dcdb446 | |||
| a78fd6ca69 | |||
| ddb9220abf | |||
| 9cd335d44b | |||
| bcc889f6cf | |||
| d61e4fe879 | |||
| ee62dcd8dc | |||
| b3750a8461 | |||
| 8e3a2942a5 | |||
| c3ef1ceadf | |||
| 44eebb8bc1 | |||
| 7ecfa2e7fd | |||
| 751bb353fe | |||
| f11f309090 | |||
| 3a6c11773d | |||
| 0823df7daa | |||
| 11af1189d7 | |||
| f118c05e87 | |||
| be0e76bf84 | |||
| f66f7ed7ff | |||
| ec621aae2d | |||
| 2814c01b09 | |||
| 4dc5ea0e80 | |||
| 32f66cbe51 |
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Create matrix
|
||||
id: platforms
|
||||
@ -50,7 +50,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
@ -93,7 +93,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Create matrix
|
||||
id: platforms
|
||||
@ -115,7 +115,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
-
|
||||
|
||||
2
.github/workflows/e2e.yml
vendored
2
.github/workflows/e2e.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Update daemon.json
|
||||
run: |
|
||||
|
||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
@ -56,14 +56,14 @@ jobs:
|
||||
git config --system core.eol lf
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: ${{ env.GOPATH }}/src/github.com/docker/cli
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.20.4
|
||||
go-version: 1.20.10
|
||||
-
|
||||
name: Test
|
||||
run: |
|
||||
|
||||
6
.github/workflows/validate.yml
vendored
6
.github/workflows/validate.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Run
|
||||
uses: docker/bake-action@v3
|
||||
@ -41,7 +41,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Generate
|
||||
shell: 'script --return --quiet --command "bash {0}"'
|
||||
@ -67,7 +67,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Run
|
||||
shell: 'script --return --quiet --command "bash {0}"'
|
||||
|
||||
@ -32,12 +32,11 @@ run:
|
||||
|
||||
linters-settings:
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
include-go-root: true
|
||||
packages:
|
||||
# The io/ioutil package has been deprecated.
|
||||
# https://go.dev/doc/go1.16#ioutil
|
||||
- io/ioutil
|
||||
rules:
|
||||
main:
|
||||
deny:
|
||||
- pkg: io/ioutil
|
||||
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
|
||||
gocyclo:
|
||||
min-complexity: 16
|
||||
govet:
|
||||
@ -117,7 +116,10 @@ issues:
|
||||
- text: "package-comments: should have a package comment"
|
||||
linters:
|
||||
- revive
|
||||
|
||||
# FIXME temporarily suppress these (see https://github.com/gotestyourself/gotest.tools/issues/272)
|
||||
- text: "SA1019: (assert|cmp|is)\\.ErrorType is deprecated"
|
||||
linters:
|
||||
- staticcheck
|
||||
# Exclude some linters from running on tests files.
|
||||
- path: _test\.go
|
||||
linters:
|
||||
|
||||
@ -192,7 +192,7 @@ For more details, see the [MAINTAINERS](MAINTAINERS) page.
|
||||
The sign-off is a simple line at the end of the explanation for the patch. Your
|
||||
signature certifies that you wrote the patch or otherwise have the right to pass
|
||||
it on as an open-source patch. The rules are pretty simple: if you can certify
|
||||
the below (from [developercertificate.org](http://developercertificate.org/)):
|
||||
the below (from [developercertificate.org](https://developercertificate.org):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
@ -336,9 +336,8 @@ The rules:
|
||||
1. All code should be formatted with `gofumpt` (preferred) or `gofmt -s`.
|
||||
2. All code should pass the default levels of
|
||||
[`golint`](https://github.com/golang/lint).
|
||||
3. All code should follow the guidelines covered in [Effective
|
||||
Go](http://golang.org/doc/effective_go.html) and [Go Code Review
|
||||
Comments](https://github.com/golang/go/wiki/CodeReviewComments).
|
||||
3. All code should follow the guidelines covered in [Effective Go](https://go.dev/doc/effective_go)
|
||||
and [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments).
|
||||
4. Comment the code. Tell us the why, the history and the context.
|
||||
5. Document _all_ declarations and methods, even private ones. Declare
|
||||
expectations, caveats and anything else that may be important. If a type
|
||||
@ -360,6 +359,6 @@ The rules:
|
||||
guidelines. Since you've read all the rules, you now know that.
|
||||
|
||||
If you are having trouble getting into the mood of idiomatic Go, we recommend
|
||||
reading through [Effective Go](https://golang.org/doc/effective_go.html). The
|
||||
[Go Blog](https://blog.golang.org) is also a great resource. Drinking the
|
||||
reading through [Effective Go](https://go.dev/doc/effective_go). The
|
||||
[Go Blog](https://go.dev/blog/) is also a great resource. Drinking the
|
||||
kool-aid is a lot easier than going thirsty.
|
||||
|
||||
48
Dockerfile
48
Dockerfile
@ -1,17 +1,19 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG BASE_VARIANT=alpine
|
||||
ARG GO_VERSION=1.20.4
|
||||
ARG ALPINE_VERSION=3.16
|
||||
ARG XX_VERSION=1.1.1
|
||||
ARG GO_VERSION=1.20.10
|
||||
ARG ALPINE_VERSION=3.17
|
||||
ARG XX_VERSION=1.2.1
|
||||
ARG GOVERSIONINFO_VERSION=v1.3.0
|
||||
ARG GOTESTSUM_VERSION=v1.8.2
|
||||
ARG BUILDX_VERSION=0.10.4
|
||||
ARG GOTESTSUM_VERSION=v1.10.0
|
||||
ARG BUILDX_VERSION=0.11.2
|
||||
ARG COMPOSE_VERSION=v2.22.0
|
||||
|
||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build-base-alpine
|
||||
COPY --from=xx / /
|
||||
ENV GOTOOLCHAIN=local
|
||||
COPY --link --from=xx / /
|
||||
RUN apk add --no-cache bash clang lld llvm file git
|
||||
WORKDIR /go/src/github.com/docker/cli
|
||||
|
||||
@ -21,7 +23,8 @@ ARG TARGETPLATFORM
|
||||
RUN xx-apk add --no-cache musl-dev gcc
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-bullseye
|
||||
COPY --from=xx / /
|
||||
ENV GOTOOLCHAIN=local
|
||||
COPY --link --from=xx / /
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y bash clang lld llvm file
|
||||
WORKDIR /go/src/github.com/docker/cli
|
||||
|
||||
@ -40,13 +43,13 @@ FROM build-base-${BASE_VARIANT} AS goversioninfo
|
||||
ARG GOVERSIONINFO_VERSION
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
GOBIN=/out GO111MODULE=on go install "github.com/josephspurrier/goversioninfo/cmd/goversioninfo@${GOVERSIONINFO_VERSION}"
|
||||
GOBIN=/out GO111MODULE=on CGO_ENABLED=0 go install "github.com/josephspurrier/goversioninfo/cmd/goversioninfo@${GOVERSIONINFO_VERSION}"
|
||||
|
||||
FROM build-base-${BASE_VARIANT} AS gotestsum
|
||||
ARG GOTESTSUM_VERSION
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
GOBIN=/out GO111MODULE=on go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
|
||||
GOBIN=/out GO111MODULE=on CGO_ENABLED=0 go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
|
||||
&& /out/gotestsum --version
|
||||
|
||||
FROM build-${BASE_VARIANT} AS build
|
||||
@ -62,7 +65,7 @@ ARG CGO_ENABLED
|
||||
ARG VERSION
|
||||
# PACKAGER_NAME sets the company that produced the windows binary
|
||||
ARG PACKAGER_NAME
|
||||
COPY --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo
|
||||
COPY --link --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo
|
||||
# in bullseye arm64 target does not link with lld so configure it to use ld instead
|
||||
RUN [ ! -f /etc/alpine-release ] && xx-info is-cross && [ "$(xx-info arch)" = "arm64" ] && XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple || true
|
||||
RUN --mount=type=bind,target=.,ro \
|
||||
@ -76,7 +79,7 @@ RUN --mount=type=bind,target=.,ro \
|
||||
xx-verify $([ "$GO_LINKMODE" = "static" ] && echo "--static") /out/docker
|
||||
|
||||
FROM build-${BASE_VARIANT} AS test
|
||||
COPY --from=gotestsum /out/gotestsum /usr/bin/gotestsum
|
||||
COPY --link --from=gotestsum /out/gotestsum /usr/bin/gotestsum
|
||||
ENV GO111MODULE=auto
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
@ -98,32 +101,31 @@ RUN --mount=ro --mount=type=cache,target=/root/.cache \
|
||||
TARGET=/out ./scripts/build/plugins e2e/cli-plugins/plugins/*
|
||||
|
||||
FROM build-base-alpine AS e2e-base-alpine
|
||||
RUN apk add --no-cache build-base curl docker-compose openssl openssh-client
|
||||
RUN apk add --no-cache build-base curl openssl openssh-client
|
||||
|
||||
FROM build-base-bullseye AS e2e-base-bullseye
|
||||
RUN apt-get update && apt-get install -y build-essential curl openssl openssh-client
|
||||
ARG COMPOSE_VERSION=1.29.2
|
||||
RUN curl -fsSL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && \
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
|
||||
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
|
||||
FROM docker/compose-bin:${COMPOSE_VERSION} AS compose
|
||||
|
||||
FROM e2e-base-${BASE_VARIANT} AS e2e
|
||||
ARG NOTARY_VERSION=v0.6.1
|
||||
ADD --chmod=0755 https://github.com/theupdateframework/notary/releases/download/${NOTARY_VERSION}/notary-Linux-amd64 /usr/local/bin/notary
|
||||
COPY e2e/testdata/notary/root-ca.cert /usr/share/ca-certificates/notary.cert
|
||||
COPY --link e2e/testdata/notary/root-ca.cert /usr/share/ca-certificates/notary.cert
|
||||
RUN echo 'notary.cert' >> /etc/ca-certificates.conf && update-ca-certificates
|
||||
COPY --from=gotestsum /out/gotestsum /usr/bin/gotestsum
|
||||
COPY --from=build /out ./build/
|
||||
COPY --from=build-plugins /out ./build/
|
||||
COPY --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
COPY . .
|
||||
COPY --link --from=gotestsum /out/gotestsum /usr/bin/gotestsum
|
||||
COPY --link --from=build /out ./build/
|
||||
COPY --link --from=build-plugins /out ./build/
|
||||
COPY --link --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
COPY --link --from=compose /docker-compose /usr/libexec/docker/cli-plugins/docker-compose
|
||||
COPY --link . .
|
||||
ENV DOCKER_BUILDKIT=1
|
||||
ENV PATH=/go/src/github.com/docker/cli/build:$PATH
|
||||
CMD ./scripts/test/e2e/entry
|
||||
|
||||
FROM build-base-${BASE_VARIANT} AS dev
|
||||
COPY . .
|
||||
COPY --link . .
|
||||
|
||||
FROM scratch AS plugins
|
||||
COPY --from=build-plugins /out .
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -327,13 +326,8 @@ func (cli *DockerCli) getInitTimeout() time.Duration {
|
||||
|
||||
func (cli *DockerCli) initializeFromClient() {
|
||||
ctx := context.Background()
|
||||
if !strings.HasPrefix(cli.dockerEndpoint.Host, "ssh://") {
|
||||
// @FIXME context.WithTimeout doesn't work with connhelper / ssh connections
|
||||
// time="2020-04-10T10:16:26Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
|
||||
var cancel func()
|
||||
ctx, cancel = context.WithTimeout(ctx, cli.getInitTimeout())
|
||||
defer cancel()
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(ctx, cli.getInitTimeout())
|
||||
defer cancel()
|
||||
|
||||
ping, err := cli.client.Ping(ctx)
|
||||
if err != nil {
|
||||
@ -381,7 +375,7 @@ func (cli *DockerCli) ContextStore() store.Store {
|
||||
// the "default" context is used if:
|
||||
//
|
||||
// - The "--host" option is set
|
||||
// - The "DOCKER_HOST" ([DefaultContextName]) environment variable is set
|
||||
// - The "DOCKER_HOST" ([client.EnvOverrideHost]) environment variable is set
|
||||
// to a non-empty value.
|
||||
//
|
||||
// In these cases, the default context is used, which uses the host as
|
||||
|
||||
@ -354,7 +354,10 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
|
||||
volumes := copts.volumes.GetMap()
|
||||
// add any bind targets to the list of container volumes
|
||||
for bind := range copts.volumes.GetMap() {
|
||||
parsed, _ := loader.ParseVolume(bind)
|
||||
parsed, err := loader.ParseVolume(bind)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if parsed.Source != "" {
|
||||
toBind := bind
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/cli/cli/command"
|
||||
@ -13,7 +14,6 @@ import (
|
||||
"github.com/docker/cli/cli/config/configfile"
|
||||
"github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/homedir"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@ -57,7 +57,11 @@ func TestUseDefaultWithoutConfigFile(t *testing.T) {
|
||||
// the _default_ configuration file. If we specify a custom configuration
|
||||
// file, the CLI produces an error if the file doesn't exist.
|
||||
tmpHomeDir := t.TempDir()
|
||||
t.Setenv(homedir.Key(), tmpHomeDir)
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Setenv("USERPROFILE", tmpHomeDir)
|
||||
} else {
|
||||
t.Setenv("HOME", tmpHomeDir)
|
||||
}
|
||||
configDir := filepath.Join(tmpHomeDir, ".docker")
|
||||
configFilePath := filepath.Join(configDir, "config.json")
|
||||
|
||||
|
||||
@ -3,28 +3,28 @@ package command
|
||||
import (
|
||||
"sync"
|
||||
|
||||
eventtypes "github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// EventHandler is abstract interface for user to customize
|
||||
// own handle functions of each type of events
|
||||
type EventHandler interface {
|
||||
Handle(action string, h func(eventtypes.Message))
|
||||
Watch(c <-chan eventtypes.Message)
|
||||
Handle(action string, h func(events.Message))
|
||||
Watch(c <-chan events.Message)
|
||||
}
|
||||
|
||||
// InitEventHandler initializes and returns an EventHandler
|
||||
func InitEventHandler() EventHandler {
|
||||
return &eventHandler{handlers: make(map[string]func(eventtypes.Message))}
|
||||
return &eventHandler{handlers: make(map[string]func(events.Message))}
|
||||
}
|
||||
|
||||
type eventHandler struct {
|
||||
handlers map[string]func(eventtypes.Message)
|
||||
handlers map[string]func(events.Message)
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (w *eventHandler) Handle(action string, h func(eventtypes.Message)) {
|
||||
func (w *eventHandler) Handle(action string, h func(events.Message)) {
|
||||
w.mu.Lock()
|
||||
w.handlers[action] = h
|
||||
w.mu.Unlock()
|
||||
@ -33,7 +33,7 @@ func (w *eventHandler) Handle(action string, h func(eventtypes.Message)) {
|
||||
// Watch ranges over the passed in event chan and processes the events based on the
|
||||
// handlers created for a given action.
|
||||
// To stop watching, close the event chan.
|
||||
func (w *eventHandler) Watch(c <-chan eventtypes.Message) {
|
||||
func (w *eventHandler) Watch(c <-chan events.Message) {
|
||||
for e := range c {
|
||||
w.mu.Lock()
|
||||
h, exists := w.handlers[e.Action]
|
||||
|
||||
@ -128,7 +128,7 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command {
|
||||
flags.Int64Var(&options.cpuQuota, "cpu-quota", 0, "Limit the CPU CFS (Completely Fair Scheduler) quota")
|
||||
flags.StringVar(&options.cpuSetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)")
|
||||
flags.StringVar(&options.cpuSetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
|
||||
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
|
||||
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", `Set the parent cgroup for the "RUN" instructions during build`)
|
||||
flags.StringVar(&options.isolation, "isolation", "", "Container isolation technology")
|
||||
flags.Var(&options.labels, "label", "Set metadata for an image")
|
||||
flags.BoolVar(&options.noCache, "no-cache", false, "Do not use cache when building the image")
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
|
||||
"github.com/moby/patternmatcher"
|
||||
"github.com/moby/patternmatcher/ignorefile"
|
||||
)
|
||||
|
||||
// ReadDockerignore reads the .dockerignore file in the context directory and
|
||||
@ -22,7 +23,11 @@ func ReadDockerignore(contextDir string) ([]string, error) {
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return dockerignore.ReadAll(f)
|
||||
patterns, err := ignorefile.ReadAll(f)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
|
||||
}
|
||||
return patterns, nil
|
||||
}
|
||||
|
||||
// TrimBuildFilesFromExcludes removes the named Dockerfile and .dockerignore from
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/golden"
|
||||
"gotest.tools/v3/skip"
|
||||
)
|
||||
|
||||
func TestNewHistoryCommandErrors(t *testing.T) {
|
||||
@ -43,13 +42,7 @@ func TestNewHistoryCommandErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func notUTCTimezone() bool {
|
||||
now := time.Now()
|
||||
return now != now.UTC()
|
||||
}
|
||||
|
||||
func TestNewHistoryCommandSuccess(t *testing.T) {
|
||||
skip.If(t, notUTCTimezone, "expected output requires UTC timezone")
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
@ -62,6 +55,7 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
|
||||
return []image.HistoryResponseItem{{
|
||||
ID: "1234567890123456789",
|
||||
Created: time.Now().Unix(),
|
||||
Comment: "none",
|
||||
}}, nil
|
||||
},
|
||||
},
|
||||
@ -93,13 +87,19 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})
|
||||
cmd := NewHistoryCommand(cli)
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
assert.NilError(t, err)
|
||||
actual := cli.OutBuffer().String()
|
||||
golden.Assert(t, actual, fmt.Sprintf("history-command-success.%s.golden", tc.name))
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// Set to UTC timezone as timestamps in output are
|
||||
// printed in the current timezone
|
||||
t.Setenv("TZ", "UTC")
|
||||
cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})
|
||||
cmd := NewHistoryCommand(cli)
|
||||
cmd.SetOut(io.Discard)
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
assert.NilError(t, err)
|
||||
actual := cli.OutBuffer().String()
|
||||
golden.Assert(t, actual, fmt.Sprintf("history-command-success.%s.golden", tc.name))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
IMAGE CREATED AT CREATED BY SIZE COMMENT
|
||||
abcdef 2017-01-01T12:00:03Z rose 0 new history item!
|
||||
IMAGE CREATED AT CREATED BY SIZE COMMENT
|
||||
abcdef 2017-01-01T12:00:03Z rose 0 new history item!
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||
123456789012 Less than a second ago 0B
|
||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||
123456789012 Less than a second ago 0B none
|
||||
|
||||
@ -16,7 +16,7 @@ type osArch struct {
|
||||
|
||||
// Remove any unsupported os/arch combo
|
||||
// list of valid os/arch values (see "Optional Environment Variables" section
|
||||
// of https://golang.org/doc/install/source
|
||||
// of https://go.dev/doc/install/source
|
||||
// Added linux/s390x as we know System z support already exists
|
||||
// Keep in sync with _docker_manifest_annotate in contrib/completion/bash/docker
|
||||
var validOSArches = map[osArch]bool{
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
|
||||
configtypes "github.com/docker/cli/cli/config/types"
|
||||
"github.com/docker/cli/cli/hints"
|
||||
"github.com/docker/cli/cli/streams"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -19,6 +20,10 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const patSuggest = "You can log in with your password or a Personal Access " +
|
||||
"Token (PAT). Using a limited-scope PAT grants better security and is required " +
|
||||
"for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/"
|
||||
|
||||
// EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload.
|
||||
//
|
||||
// Deprecated: use [registrytypes.EncodeAuthConfig] instead.
|
||||
@ -113,7 +118,11 @@ func ConfigureAuth(cli Cli, flUser, flPassword string, authconfig *registrytypes
|
||||
if flUser = strings.TrimSpace(flUser); flUser == "" {
|
||||
if isDefaultRegistry {
|
||||
// if this is a default registry (docker hub), then display the following message.
|
||||
fmt.Fprintln(cli.Out(), "Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.")
|
||||
fmt.Fprintln(cli.Out(), "Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.")
|
||||
if hints.Enabled() {
|
||||
fmt.Fprintln(cli.Out(), patSuggest)
|
||||
fmt.Fprintln(cli.Out())
|
||||
}
|
||||
}
|
||||
promptWithDefault(cli.Out(), "Username", authconfig.Username)
|
||||
var err error
|
||||
|
||||
@ -1001,7 +1001,7 @@ const (
|
||||
flagTTY = "tty"
|
||||
flagUpdateDelay = "update-delay"
|
||||
flagUpdateFailureAction = "update-failure-action"
|
||||
flagUpdateMaxFailureRatio = "update-max-failure-ratio"
|
||||
flagUpdateMaxFailureRatio = "update-max-failure-ratio" // #nosec G101 -- ignoring: Potential hardcoded credentials (gosec)
|
||||
flagUpdateMonitor = "update-monitor"
|
||||
flagUpdateOrder = "update-order"
|
||||
flagUpdateParallelism = "update-parallelism"
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/client"
|
||||
)
|
||||
|
||||
@ -12,6 +13,7 @@ type fakeClient struct {
|
||||
|
||||
version string
|
||||
serverVersion func(ctx context.Context) (types.Version, error)
|
||||
eventsFn func(context.Context, types.EventsOptions) (<-chan events.Message, <-chan error)
|
||||
}
|
||||
|
||||
func (cli *fakeClient) ServerVersion(ctx context.Context) (types.Version, error) {
|
||||
@ -21,3 +23,7 @@ func (cli *fakeClient) ServerVersion(ctx context.Context) (types.Version, error)
|
||||
func (cli *fakeClient) ClientVersion() string {
|
||||
return cli.version
|
||||
}
|
||||
|
||||
func (cli *fakeClient) Events(ctx context.Context, opts types.EventsOptions) (<-chan events.Message, <-chan error) {
|
||||
return cli.eventsFn(ctx, opts)
|
||||
}
|
||||
|
||||
@ -12,10 +12,12 @@ import (
|
||||
"github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/command/completion"
|
||||
"github.com/docker/cli/cli/command/formatter"
|
||||
flagsHelper "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/cli/templates"
|
||||
"github.com/docker/docker/api/types"
|
||||
eventtypes "github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -47,7 +49,7 @@ func NewEventsCommand(dockerCli command.Cli) *cobra.Command {
|
||||
flags.StringVar(&options.since, "since", "", "Show all events created since timestamp")
|
||||
flags.StringVar(&options.until, "until", "", "Stream events until this timestamp")
|
||||
flags.VarP(&options.filter, "filter", "f", "Filter output based on conditions provided")
|
||||
flags.StringVar(&options.format, "format", "", "Format the output using the given Go template")
|
||||
flags.StringVar(&options.format, "format", "", flagsHelper.InspectFormatHelp) // using the same flag description as "inspect" commands for now.
|
||||
|
||||
return cmd
|
||||
}
|
||||
@ -60,21 +62,19 @@ func runEvents(dockerCli command.Cli, options *eventsOptions) error {
|
||||
Status: "Error parsing format: " + err.Error(),
|
||||
}
|
||||
}
|
||||
eventOptions := types.EventsOptions{
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
evts, errs := dockerCli.Client().Events(ctx, types.EventsOptions{
|
||||
Since: options.since,
|
||||
Until: options.until,
|
||||
Filters: options.filter.Value(),
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
events, errs := dockerCli.Client().Events(ctx, eventOptions)
|
||||
})
|
||||
defer cancel()
|
||||
|
||||
out := dockerCli.Out()
|
||||
|
||||
for {
|
||||
select {
|
||||
case event := <-events:
|
||||
case event := <-evts:
|
||||
if err := handleEvent(out, event, tmpl); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -87,7 +87,7 @@ func runEvents(dockerCli command.Cli, options *eventsOptions) error {
|
||||
}
|
||||
}
|
||||
|
||||
func handleEvent(out io.Writer, event eventtypes.Message, tmpl *template.Template) error {
|
||||
func handleEvent(out io.Writer, event events.Message, tmpl *template.Template) error {
|
||||
if tmpl == nil {
|
||||
return prettyPrintEvent(out, event)
|
||||
}
|
||||
@ -96,16 +96,19 @@ func handleEvent(out io.Writer, event eventtypes.Message, tmpl *template.Templat
|
||||
}
|
||||
|
||||
func makeTemplate(format string) (*template.Template, error) {
|
||||
if format == "" {
|
||||
switch format {
|
||||
case "":
|
||||
return nil, nil
|
||||
case formatter.JSONFormatKey:
|
||||
format = formatter.JSONFormat
|
||||
}
|
||||
tmpl, err := templates.Parse(format)
|
||||
if err != nil {
|
||||
return tmpl, err
|
||||
}
|
||||
// we execute the template for an empty message, so as to validate
|
||||
// a bad template like "{{.badFieldString}}"
|
||||
return tmpl, tmpl.Execute(io.Discard, &eventtypes.Message{})
|
||||
// execute the template on an empty message to validate a bad
|
||||
// template like "{{.badFieldString}}"
|
||||
return tmpl, tmpl.Execute(io.Discard, &events.Message{})
|
||||
}
|
||||
|
||||
// rfc3339NanoFixed is similar to time.RFC3339Nano, except it pads nanoseconds
|
||||
@ -115,7 +118,7 @@ const rfc3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
|
||||
// prettyPrintEvent prints all types of event information.
|
||||
// Each output includes the event type, actor id, name and action.
|
||||
// Actor attributes are printed at the end if the actor has any.
|
||||
func prettyPrintEvent(out io.Writer, event eventtypes.Message) error {
|
||||
func prettyPrintEvent(out io.Writer, event events.Message) error {
|
||||
if event.TimeNano != 0 {
|
||||
fmt.Fprintf(out, "%s ", time.Unix(0, event.TimeNano).Format(rfc3339NanoFixed))
|
||||
} else if event.Time != 0 {
|
||||
@ -141,7 +144,7 @@ func prettyPrintEvent(out io.Writer, event eventtypes.Message) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func formatEvent(out io.Writer, event eventtypes.Message, tmpl *template.Template) error {
|
||||
func formatEvent(out io.Writer, event events.Message, tmpl *template.Template) error {
|
||||
defer out.Write([]byte{'\n'})
|
||||
return tmpl.Execute(out, event)
|
||||
}
|
||||
|
||||
83
cli/command/system/events_test.go
Normal file
83
cli/command/system/events_test.go
Normal file
@ -0,0 +1,83 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/golden"
|
||||
)
|
||||
|
||||
func TestEventsFormat(t *testing.T) {
|
||||
var evts []events.Message
|
||||
for i, action := range []string{"create", "start", "attach", "die"} {
|
||||
evts = append(evts, events.Message{
|
||||
Status: action,
|
||||
ID: "abc123",
|
||||
From: "ubuntu:latest",
|
||||
Type: events.ContainerEventType,
|
||||
Action: action,
|
||||
Actor: events.Actor{
|
||||
ID: "abc123",
|
||||
Attributes: map[string]string{"image": "ubuntu:latest"},
|
||||
},
|
||||
Scope: "local",
|
||||
Time: int64(time.Second) * int64(i+1),
|
||||
TimeNano: int64(time.Second) * int64(i+1),
|
||||
})
|
||||
}
|
||||
tests := []struct {
|
||||
name, format string
|
||||
}{
|
||||
{
|
||||
name: "default",
|
||||
},
|
||||
{
|
||||
name: "json",
|
||||
format: "json",
|
||||
},
|
||||
{
|
||||
name: "json template",
|
||||
format: "{{ json . }}",
|
||||
},
|
||||
{
|
||||
name: "json action",
|
||||
format: "{{ json .Action }}",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// Set to UTC timezone as timestamps in output are
|
||||
// printed in the current timezone
|
||||
t.Setenv("TZ", "UTC")
|
||||
cli := test.NewFakeCli(&fakeClient{eventsFn: func(context.Context, types.EventsOptions) (<-chan events.Message, <-chan error) {
|
||||
messages := make(chan events.Message)
|
||||
errs := make(chan error, 1)
|
||||
go func() {
|
||||
for _, msg := range evts {
|
||||
messages <- msg
|
||||
}
|
||||
errs <- io.EOF
|
||||
}()
|
||||
return messages, errs
|
||||
}})
|
||||
cmd := NewEventsCommand(cli)
|
||||
if tc.format != "" {
|
||||
cmd.Flags().Set("format", tc.format)
|
||||
}
|
||||
assert.Check(t, cmd.Execute())
|
||||
out := cli.OutBuffer().String()
|
||||
assert.Check(t, golden.String(out, fmt.Sprintf("docker-events-%s.golden", strings.ReplaceAll(tc.name, " ", "-"))))
|
||||
cli.OutBuffer().Reset()
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -313,7 +313,12 @@ func prettyPrintServerInfo(streams command.Streams, info *info) []error {
|
||||
fprintln(output, " Docker Root Dir:", info.DockerRootDir)
|
||||
fprintln(output, " Debug Mode:", info.Debug)
|
||||
|
||||
if info.Debug {
|
||||
// The daemon collects this information regardless if "debug" is
|
||||
// enabled. Print the debugging information if either the daemon,
|
||||
// or the client has debug enabled. We should probably improve this
|
||||
// logic and print any of these if set (but some special rules are
|
||||
// needed for file-descriptors, which may use "-1".
|
||||
if info.Debug || debug.IsEnabled() {
|
||||
fprintln(output, " File Descriptors:", info.NFd)
|
||||
fprintln(output, " Goroutines:", info.NGoroutines)
|
||||
fprintln(output, " System Time:", info.SystemTime)
|
||||
|
||||
@ -48,7 +48,7 @@ func newPruneCommand(dockerCli command.Cli) *cobra.Command {
|
||||
flags := cmd.Flags()
|
||||
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation")
|
||||
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images not just dangling ones")
|
||||
flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune volumes")
|
||||
flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune anonymous volumes")
|
||||
flags.Var(&options.filter, "filter", `Provide filter values (e.g. "label=<key>=<value>")`)
|
||||
// "filter" flag is available in 1.28 (docker 17.04) and up
|
||||
flags.SetAnnotation("filter", "version", []string{"1.28"})
|
||||
@ -114,7 +114,7 @@ func confirmationMessage(dockerCli command.Cli, options pruneOptions) string {
|
||||
"all networks not used by at least one container",
|
||||
}
|
||||
if options.pruneVolumes {
|
||||
warnings = append(warnings, "all volumes not used by at least one container")
|
||||
warnings = append(warnings, "all anonymous volumes not used by at least one container")
|
||||
}
|
||||
if options.all {
|
||||
warnings = append(warnings, "all images without at least one container associated to them")
|
||||
|
||||
4
cli/command/system/testdata/docker-events-default.golden
vendored
Normal file
4
cli/command/system/testdata/docker-events-default.golden
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
1970-01-01T00:00:01.000000000Z container create abc123 (image=ubuntu:latest)
|
||||
1970-01-01T00:00:02.000000000Z container start abc123 (image=ubuntu:latest)
|
||||
1970-01-01T00:00:03.000000000Z container attach abc123 (image=ubuntu:latest)
|
||||
1970-01-01T00:00:04.000000000Z container die abc123 (image=ubuntu:latest)
|
||||
4
cli/command/system/testdata/docker-events-json-action.golden
vendored
Normal file
4
cli/command/system/testdata/docker-events-json-action.golden
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
"create"
|
||||
"start"
|
||||
"attach"
|
||||
"die"
|
||||
4
cli/command/system/testdata/docker-events-json-template.golden
vendored
Normal file
4
cli/command/system/testdata/docker-events-json-template.golden
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{"status":"create","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"create","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":1000000000,"timeNano":1000000000}
|
||||
{"status":"start","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"start","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":2000000000,"timeNano":2000000000}
|
||||
{"status":"attach","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"attach","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":3000000000,"timeNano":3000000000}
|
||||
{"status":"die","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"die","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":4000000000,"timeNano":4000000000}
|
||||
4
cli/command/system/testdata/docker-events-json.golden
vendored
Normal file
4
cli/command/system/testdata/docker-events-json.golden
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{"status":"create","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"create","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":1000000000,"timeNano":1000000000}
|
||||
{"status":"start","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"start","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":2000000000,"timeNano":2000000000}
|
||||
{"status":"attach","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"attach","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":3000000000,"timeNano":3000000000}
|
||||
{"status":"die","id":"abc123","from":"ubuntu:latest","Type":"container","Action":"die","Actor":{"ID":"abc123","Attributes":{"image":"ubuntu:latest"}},"scope":"local","time":4000000000,"timeNano":4000000000}
|
||||
@ -27,7 +27,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command {
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "prune [OPTIONS]",
|
||||
Short: "Remove all unused local volumes",
|
||||
Short: "Remove unused local volumes",
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
spaceReclaimed, output, err := runPrune(dockerCli, options)
|
||||
|
||||
@ -223,3 +223,8 @@ func TestParseVolumeInvalidSections(t *testing.T) {
|
||||
_, err := ParseVolume("/foo::rw")
|
||||
assert.ErrorContains(t, err, "invalid spec")
|
||||
}
|
||||
|
||||
func TestParseVolumeWithEmptySource(t *testing.T) {
|
||||
_, err := ParseVolume(":/vol")
|
||||
assert.ErrorContains(t, err, "empty section between colons")
|
||||
}
|
||||
|
||||
@ -94,6 +94,9 @@ func (configFile *ConfigFile) ContainsAuth() bool {
|
||||
|
||||
// GetAuthConfigs returns the mapping of repo to auth configuration
|
||||
func (configFile *ConfigFile) GetAuthConfigs() map[string]types.AuthConfig {
|
||||
if configFile.AuthConfigs == nil {
|
||||
configFile.AuthConfigs = make(map[string]types.AuthConfig)
|
||||
}
|
||||
return configFile.AuthConfigs
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,8 @@ func (c *fileStore) GetAll() (map[string]types.AuthConfig, error) {
|
||||
|
||||
// Store saves the given credentials in the file store.
|
||||
func (c *fileStore) Store(authConfig types.AuthConfig) error {
|
||||
c.file.GetAuthConfigs()[authConfig.ServerAddress] = authConfig
|
||||
authConfigs := c.file.GetAuthConfigs()
|
||||
authConfigs[authConfig.ServerAddress] = authConfig
|
||||
return c.file.Save()
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@ -64,81 +65,68 @@ func New(_ context.Context, cmd string, args ...string) (net.Conn, error) {
|
||||
|
||||
// commandConn implements net.Conn
|
||||
type commandConn struct {
|
||||
cmd *exec.Cmd
|
||||
cmdExited bool
|
||||
cmdWaitErr error
|
||||
cmdMutex sync.Mutex
|
||||
stdin io.WriteCloser
|
||||
stdout io.ReadCloser
|
||||
stderrMu sync.Mutex
|
||||
stderr bytes.Buffer
|
||||
stdioClosedMu sync.Mutex // for stdinClosed and stdoutClosed
|
||||
stdinClosed bool
|
||||
stdoutClosed bool
|
||||
localAddr net.Addr
|
||||
remoteAddr net.Addr
|
||||
cmdMutex sync.Mutex // for cmd, cmdWaitErr
|
||||
cmd *exec.Cmd
|
||||
cmdWaitErr error
|
||||
cmdExited atomic.Bool
|
||||
stdin io.WriteCloser
|
||||
stdout io.ReadCloser
|
||||
stderrMu sync.Mutex // for stderr
|
||||
stderr bytes.Buffer
|
||||
stdinClosed atomic.Bool
|
||||
stdoutClosed atomic.Bool
|
||||
closing atomic.Bool
|
||||
localAddr net.Addr
|
||||
remoteAddr net.Addr
|
||||
}
|
||||
|
||||
// killIfStdioClosed kills the cmd if both stdin and stdout are closed.
|
||||
func (c *commandConn) killIfStdioClosed() error {
|
||||
c.stdioClosedMu.Lock()
|
||||
stdioClosed := c.stdoutClosed && c.stdinClosed
|
||||
c.stdioClosedMu.Unlock()
|
||||
if !stdioClosed {
|
||||
return nil
|
||||
// kill terminates the process. On Windows it kills the process directly,
|
||||
// whereas on other platforms, a SIGTERM is sent, before forcefully terminating
|
||||
// the process after 3 seconds.
|
||||
func (c *commandConn) kill() {
|
||||
if c.cmdExited.Load() {
|
||||
return
|
||||
}
|
||||
return c.kill()
|
||||
}
|
||||
|
||||
// killAndWait tries sending SIGTERM to the process before sending SIGKILL.
|
||||
func killAndWait(cmd *exec.Cmd) error {
|
||||
c.cmdMutex.Lock()
|
||||
var werr error
|
||||
if runtime.GOOS != "windows" {
|
||||
werrCh := make(chan error)
|
||||
go func() { werrCh <- cmd.Wait() }()
|
||||
cmd.Process.Signal(syscall.SIGTERM)
|
||||
go func() { werrCh <- c.cmd.Wait() }()
|
||||
_ = c.cmd.Process.Signal(syscall.SIGTERM)
|
||||
select {
|
||||
case werr = <-werrCh:
|
||||
case <-time.After(3 * time.Second):
|
||||
cmd.Process.Kill()
|
||||
_ = c.cmd.Process.Kill()
|
||||
werr = <-werrCh
|
||||
}
|
||||
} else {
|
||||
cmd.Process.Kill()
|
||||
werr = cmd.Wait()
|
||||
}
|
||||
return werr
|
||||
}
|
||||
|
||||
// kill returns nil if the command terminated, regardless to the exit status.
|
||||
func (c *commandConn) kill() error {
|
||||
var werr error
|
||||
c.cmdMutex.Lock()
|
||||
if c.cmdExited {
|
||||
werr = c.cmdWaitErr
|
||||
} else {
|
||||
werr = killAndWait(c.cmd)
|
||||
c.cmdWaitErr = werr
|
||||
c.cmdExited = true
|
||||
_ = c.cmd.Process.Kill()
|
||||
werr = c.cmd.Wait()
|
||||
}
|
||||
c.cmdWaitErr = werr
|
||||
c.cmdMutex.Unlock()
|
||||
if werr == nil {
|
||||
return nil
|
||||
}
|
||||
wExitErr, ok := werr.(*exec.ExitError)
|
||||
if ok {
|
||||
if wExitErr.ProcessState.Exited() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return errors.Wrapf(werr, "commandconn: failed to wait")
|
||||
c.cmdExited.Store(true)
|
||||
}
|
||||
|
||||
func (c *commandConn) onEOF(eof error) error {
|
||||
// when we got EOF, the command is going to be terminated
|
||||
var werr error
|
||||
// handleEOF handles io.EOF errors while reading or writing from the underlying
|
||||
// command pipes.
|
||||
//
|
||||
// When we've received an EOF we expect that the command will
|
||||
// be terminated soon. As such, we call Wait() on the command
|
||||
// and return EOF or the error depending on whether the command
|
||||
// exited with an error.
|
||||
//
|
||||
// If Wait() does not return within 10s, an error is returned
|
||||
func (c *commandConn) handleEOF(err error) error {
|
||||
if err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
c.cmdMutex.Lock()
|
||||
if c.cmdExited {
|
||||
defer c.cmdMutex.Unlock()
|
||||
|
||||
var werr error
|
||||
if c.cmdExited.Load() {
|
||||
werr = c.cmdWaitErr
|
||||
} else {
|
||||
werrCh := make(chan error)
|
||||
@ -146,18 +134,17 @@ func (c *commandConn) onEOF(eof error) error {
|
||||
select {
|
||||
case werr = <-werrCh:
|
||||
c.cmdWaitErr = werr
|
||||
c.cmdExited = true
|
||||
c.cmdExited.Store(true)
|
||||
case <-time.After(10 * time.Second):
|
||||
c.cmdMutex.Unlock()
|
||||
c.stderrMu.Lock()
|
||||
stderr := c.stderr.String()
|
||||
c.stderrMu.Unlock()
|
||||
return errors.Errorf("command %v did not exit after %v: stderr=%q", c.cmd.Args, eof, stderr)
|
||||
return errors.Errorf("command %v did not exit after %v: stderr=%q", c.cmd.Args, err, stderr)
|
||||
}
|
||||
}
|
||||
c.cmdMutex.Unlock()
|
||||
|
||||
if werr == nil {
|
||||
return eof
|
||||
return err
|
||||
}
|
||||
c.stderrMu.Lock()
|
||||
stderr := c.stderr.String()
|
||||
@ -166,71 +153,86 @@ func (c *commandConn) onEOF(eof error) error {
|
||||
}
|
||||
|
||||
func ignorableCloseError(err error) bool {
|
||||
errS := err.Error()
|
||||
ss := []string{
|
||||
os.ErrClosed.Error(),
|
||||
}
|
||||
for _, s := range ss {
|
||||
if strings.Contains(errS, s) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *commandConn) CloseRead() error {
|
||||
// NOTE: maybe already closed here
|
||||
if err := c.stdout.Close(); err != nil && !ignorableCloseError(err) {
|
||||
logrus.Warnf("commandConn.CloseRead: %v", err)
|
||||
}
|
||||
c.stdioClosedMu.Lock()
|
||||
c.stdoutClosed = true
|
||||
c.stdioClosedMu.Unlock()
|
||||
if err := c.killIfStdioClosed(); err != nil {
|
||||
logrus.Warnf("commandConn.CloseRead: %v", err)
|
||||
}
|
||||
return nil
|
||||
return strings.Contains(err.Error(), os.ErrClosed.Error())
|
||||
}
|
||||
|
||||
func (c *commandConn) Read(p []byte) (int, error) {
|
||||
n, err := c.stdout.Read(p)
|
||||
if err == io.EOF {
|
||||
err = c.onEOF(err)
|
||||
// check after the call to Read, since
|
||||
// it is blocking, and while waiting on it
|
||||
// Close might get called
|
||||
if c.closing.Load() {
|
||||
// If we're currently closing the connection
|
||||
// we don't want to call onEOF
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c *commandConn) CloseWrite() error {
|
||||
// NOTE: maybe already closed here
|
||||
if err := c.stdin.Close(); err != nil && !ignorableCloseError(err) {
|
||||
logrus.Warnf("commandConn.CloseWrite: %v", err)
|
||||
}
|
||||
c.stdioClosedMu.Lock()
|
||||
c.stdinClosed = true
|
||||
c.stdioClosedMu.Unlock()
|
||||
if err := c.killIfStdioClosed(); err != nil {
|
||||
logrus.Warnf("commandConn.CloseWrite: %v", err)
|
||||
}
|
||||
return nil
|
||||
return n, c.handleEOF(err)
|
||||
}
|
||||
|
||||
func (c *commandConn) Write(p []byte) (int, error) {
|
||||
n, err := c.stdin.Write(p)
|
||||
if err == io.EOF {
|
||||
err = c.onEOF(err)
|
||||
// check after the call to Write, since
|
||||
// it is blocking, and while waiting on it
|
||||
// Close might get called
|
||||
if c.closing.Load() {
|
||||
// If we're currently closing the connection
|
||||
// we don't want to call onEOF
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
|
||||
return n, c.handleEOF(err)
|
||||
}
|
||||
|
||||
// CloseRead allows commandConn to implement halfCloser
|
||||
func (c *commandConn) CloseRead() error {
|
||||
// NOTE: maybe already closed here
|
||||
if err := c.stdout.Close(); err != nil && !ignorableCloseError(err) {
|
||||
return err
|
||||
}
|
||||
c.stdoutClosed.Store(true)
|
||||
|
||||
if c.stdinClosed.Load() {
|
||||
c.kill()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CloseWrite allows commandConn to implement halfCloser
|
||||
func (c *commandConn) CloseWrite() error {
|
||||
// NOTE: maybe already closed here
|
||||
if err := c.stdin.Close(); err != nil && !ignorableCloseError(err) {
|
||||
return err
|
||||
}
|
||||
c.stdinClosed.Store(true)
|
||||
|
||||
if c.stdoutClosed.Load() {
|
||||
c.kill()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close is the net.Conn func that gets called
|
||||
// by the transport when a dial is cancelled
|
||||
// due to it's context timing out. Any blocked
|
||||
// Read or Write calls will be unblocked and
|
||||
// return errors. It will block until the underlying
|
||||
// command has terminated.
|
||||
func (c *commandConn) Close() error {
|
||||
var err error
|
||||
if err = c.CloseRead(); err != nil {
|
||||
c.closing.Store(true)
|
||||
defer c.closing.Store(false)
|
||||
|
||||
if err := c.CloseRead(); err != nil {
|
||||
logrus.Warnf("commandConn.Close: CloseRead: %v", err)
|
||||
return err
|
||||
}
|
||||
if err = c.CloseWrite(); err != nil {
|
||||
if err := c.CloseWrite(); err != nil {
|
||||
logrus.Warnf("commandConn.Close: CloseWrite: %v", err)
|
||||
return err
|
||||
}
|
||||
return err
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *commandConn) LocalAddr() net.Addr {
|
||||
|
||||
@ -6,8 +6,11 @@ package commandconn
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"io/fs"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/process"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@ -43,3 +46,170 @@ func TestEOFWithoutError(t *testing.T) {
|
||||
assert.Check(t, is.Equal(0, n))
|
||||
assert.Check(t, is.Equal(io.EOF, err))
|
||||
}
|
||||
|
||||
func TestCloseRunningCommand(t *testing.T) {
|
||||
cmd := "sh"
|
||||
args := []string{"-c", "while true; sleep 1; done"}
|
||||
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
|
||||
go func() {
|
||||
c, err := New(context.TODO(), cmd, args...)
|
||||
assert.NilError(t, err)
|
||||
cmdConn := c.(*commandConn)
|
||||
assert.Check(t, process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
n, err := c.Write([]byte("hello"))
|
||||
assert.Check(t, is.Equal(len("hello"), n))
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
err = cmdConn.Close()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, !process.Alive(cmdConn.cmd.Process.Pid))
|
||||
done <- struct{}{}
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Error("test did not finish in time")
|
||||
case <-done:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloseTwice(t *testing.T) {
|
||||
cmd := "sh"
|
||||
args := []string{"-c", "echo hello; sleep 1; exit 0"}
|
||||
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
c, err := New(context.TODO(), cmd, args...)
|
||||
assert.NilError(t, err)
|
||||
cmdConn := c.(*commandConn)
|
||||
assert.Check(t, process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
b := make([]byte, 32)
|
||||
n, err := c.Read(b)
|
||||
assert.Check(t, is.Equal(len("hello\n"), n))
|
||||
assert.NilError(t, err)
|
||||
|
||||
err = cmdConn.Close()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, !process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
err = cmdConn.Close()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, !process.Alive(cmdConn.cmd.Process.Pid))
|
||||
done <- struct{}{}
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-time.After(10 * time.Second):
|
||||
t.Error("test did not finish in time")
|
||||
case <-done:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func TestEOFTimeout(t *testing.T) {
|
||||
cmd := "sh"
|
||||
args := []string{"-c", "sleep 20"}
|
||||
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
c, err := New(context.TODO(), cmd, args...)
|
||||
assert.NilError(t, err)
|
||||
cmdConn := c.(*commandConn)
|
||||
assert.Check(t, process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
cmdConn.stdout = mockStdoutEOF{}
|
||||
|
||||
b := make([]byte, 32)
|
||||
n, err := c.Read(b)
|
||||
assert.Check(t, is.Equal(0, n))
|
||||
assert.ErrorContains(t, err, "did not exit after EOF")
|
||||
|
||||
done <- struct{}{}
|
||||
}()
|
||||
|
||||
// after receiving an EOF, we try to kill the command
|
||||
// if it doesn't exit after 10s, we throw an error
|
||||
select {
|
||||
case <-time.After(12 * time.Second):
|
||||
t.Error("test did not finish in time")
|
||||
case <-done:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
type mockStdoutEOF struct{}
|
||||
|
||||
func (mockStdoutEOF) Read(_ []byte) (int, error) {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
func (mockStdoutEOF) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestCloseWhileWriting(t *testing.T) {
|
||||
cmd := "sh"
|
||||
args := []string{"-c", "while true; sleep 1; done"}
|
||||
|
||||
c, err := New(context.TODO(), cmd, args...)
|
||||
assert.NilError(t, err)
|
||||
cmdConn := c.(*commandConn)
|
||||
assert.Check(t, process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
writeErrC := make(chan error)
|
||||
go func() {
|
||||
for {
|
||||
n, err := c.Write([]byte("hello"))
|
||||
if err != nil {
|
||||
writeErrC <- err
|
||||
return
|
||||
}
|
||||
assert.Equal(t, n, len("hello"))
|
||||
}
|
||||
}()
|
||||
|
||||
err = c.Close()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, !process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
writeErr := <-writeErrC
|
||||
assert.ErrorContains(t, writeErr, "file already closed")
|
||||
assert.Check(t, is.ErrorIs(writeErr, fs.ErrClosed))
|
||||
}
|
||||
|
||||
func TestCloseWhileReading(t *testing.T) {
|
||||
cmd := "sh"
|
||||
args := []string{"-c", "while true; sleep 1; done"}
|
||||
|
||||
c, err := New(context.TODO(), cmd, args...)
|
||||
assert.NilError(t, err)
|
||||
cmdConn := c.(*commandConn)
|
||||
assert.Check(t, process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
readErrC := make(chan error)
|
||||
go func() {
|
||||
for {
|
||||
b := make([]byte, 32)
|
||||
n, err := c.Read(b)
|
||||
if err != nil {
|
||||
readErrC <- err
|
||||
return
|
||||
}
|
||||
assert.Check(t, is.Equal(0, n))
|
||||
}
|
||||
}()
|
||||
|
||||
err = cmdConn.Close()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, !process.Alive(cmdConn.cmd.Process.Pid))
|
||||
|
||||
readErr := <-readErrC
|
||||
assert.Check(t, is.ErrorIs(readErr, fs.ErrClosed))
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/cli/cli/connhelper/commandconn"
|
||||
"github.com/docker/cli/cli/connhelper/ssh"
|
||||
@ -51,6 +52,7 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*ConnectionHelper
|
||||
if sp.Path != "" {
|
||||
args = append(args, "--host", "unix://"+sp.Path)
|
||||
}
|
||||
sshFlags = addSSHTimeout(sshFlags)
|
||||
args = append(args, "system", "dial-stdio")
|
||||
return commandconn.New(ctx, "ssh", append(sshFlags, sp.Args(args...)...)...)
|
||||
},
|
||||
@ -71,3 +73,10 @@ func GetCommandConnectionHelper(cmd string, flags ...string) (*ConnectionHelper,
|
||||
Host: "http://docker.example.com",
|
||||
}, nil
|
||||
}
|
||||
|
||||
func addSSHTimeout(sshFlags []string) []string {
|
||||
if !strings.Contains(strings.Join(sshFlags, ""), "ConnectTimeout") {
|
||||
sshFlags = append(sshFlags, "-o ConnectTimeout=30")
|
||||
}
|
||||
return sshFlags
|
||||
}
|
||||
|
||||
31
cli/connhelper/connhelper_test.go
Normal file
31
cli/connhelper/connhelper_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
package connhelper
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func TestSSHFlags(t *testing.T) {
|
||||
testCases := []struct {
|
||||
in []string
|
||||
out []string
|
||||
}{
|
||||
{
|
||||
in: []string{},
|
||||
out: []string{"-o ConnectTimeout=30"},
|
||||
},
|
||||
{
|
||||
in: []string{"option", "-o anotherOption"},
|
||||
out: []string{"option", "-o anotherOption", "-o ConnectTimeout=30"},
|
||||
},
|
||||
{
|
||||
in: []string{"-o ConnectTimeout=5", "anotherOption"},
|
||||
out: []string{"-o ConnectTimeout=5", "anotherOption"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
assert.DeepEqual(t, addSSHTimeout(tc.in), tc.out)
|
||||
}
|
||||
}
|
||||
18
cli/hints/hints.go
Normal file
18
cli/hints/hints.go
Normal file
@ -0,0 +1,18 @@
|
||||
package hints
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Enabled returns whether cli hints are enabled or not
|
||||
func Enabled() bool {
|
||||
if v := os.Getenv("DOCKER_CLI_HINTS"); v != "" {
|
||||
enabled, err := strconv.ParseBool(v)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
return enabled
|
||||
}
|
||||
return true
|
||||
}
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
manifesttypes "github.com/docker/cli/cli/manifest/types"
|
||||
"github.com/docker/cli/cli/trust"
|
||||
"github.com/docker/distribution"
|
||||
"github.com/docker/distribution/reference"
|
||||
distributionclient "github.com/docker/distribution/registry/client"
|
||||
@ -77,6 +78,7 @@ func (c *client) MountBlob(ctx context.Context, sourceRef reference.Canonical, t
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
repoEndpoint.actions = trust.ActionsPushAndPull
|
||||
repo, err := c.getRepositoryForReference(ctx, targetRef, repoEndpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -102,6 +104,7 @@ func (c *client) PutManifest(ctx context.Context, ref reference.Named, manifest
|
||||
return digest.Digest(""), err
|
||||
}
|
||||
|
||||
repoEndpoint.actions = trust.ActionsPushAndPull
|
||||
repo, err := c.getRepositoryForReference(ctx, ref, repoEndpoint)
|
||||
if err != nil {
|
||||
return digest.Digest(""), err
|
||||
@ -151,7 +154,9 @@ func (c *client) getHTTPTransportForRepoEndpoint(ctx context.Context, repoEndpoi
|
||||
c.authConfigResolver(ctx, repoEndpoint.info.Index),
|
||||
repoEndpoint.endpoint,
|
||||
repoEndpoint.Name(),
|
||||
c.userAgent)
|
||||
c.userAgent,
|
||||
repoEndpoint.actions,
|
||||
)
|
||||
return httpTransport, errors.Wrap(err, "failed to configure transport")
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/docker/cli/cli/trust"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/distribution/registry/client/auth"
|
||||
"github.com/docker/distribution/registry/client/transport"
|
||||
@ -17,6 +18,7 @@ import (
|
||||
type repositoryEndpoint struct {
|
||||
info *registry.RepositoryInfo
|
||||
endpoint registry.APIEndpoint
|
||||
actions []string
|
||||
}
|
||||
|
||||
// Name returns the repository name
|
||||
@ -74,7 +76,7 @@ func getDefaultEndpointFromRepoInfo(repoInfo *registry.RepositoryInfo) (registry
|
||||
}
|
||||
|
||||
// getHTTPTransport builds a transport for use in communicating with a registry
|
||||
func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.APIEndpoint, repoName string, userAgent string) (http.RoundTripper, error) {
|
||||
func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.APIEndpoint, repoName, userAgent string, actions []string) (http.RoundTripper, error) {
|
||||
// get the http transport, this will be used in a client to upload manifest
|
||||
base := &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
@ -98,8 +100,11 @@ func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.API
|
||||
passThruTokenHandler := &existingTokenHandler{token: authConfig.RegistryToken}
|
||||
modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, passThruTokenHandler))
|
||||
} else {
|
||||
if len(actions) == 0 {
|
||||
actions = trust.ActionsPullOnly
|
||||
}
|
||||
creds := registry.NewStaticCredentialStore(&authConfig)
|
||||
tokenHandler := auth.NewTokenHandler(authTransport, creds, repoName, "push", "pull")
|
||||
tokenHandler := auth.NewTokenHandler(authTransport, creds, repoName, actions...)
|
||||
basicHandler := auth.NewBasicHandler(creds)
|
||||
modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler))
|
||||
}
|
||||
|
||||
@ -202,7 +202,8 @@ func pullManifestList(ctx context.Context, ref reference.Named, repo distributio
|
||||
}
|
||||
|
||||
// Replace platform from config
|
||||
imageManifest.Descriptor.Platform = types.OCIPlatform(&manifestDescriptor.Platform)
|
||||
p := manifestDescriptor.Platform
|
||||
imageManifest.Descriptor.Platform = types.OCIPlatform(&p)
|
||||
|
||||
infos = append(infos, imageManifest)
|
||||
}
|
||||
@ -242,11 +243,6 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
|
||||
|
||||
confirmedTLSRegistries := make(map[string]bool)
|
||||
for _, endpoint := range endpoints {
|
||||
if endpoint.Version == registry.APIVersion1 {
|
||||
logrus.Debugf("skipping v1 endpoint %s", endpoint.URL)
|
||||
continue
|
||||
}
|
||||
|
||||
if endpoint.URL.Scheme != "https" {
|
||||
if _, confirmedTLS := confirmedTLSRegistries[endpoint.URL.Host]; confirmedTLS {
|
||||
logrus.Debugf("skipping non-TLS endpoint %s for host/port that appears to use TLS", endpoint.URL)
|
||||
|
||||
@ -402,14 +402,22 @@ func areFlagsSupported(cmd *cobra.Command, details versionDetails) error {
|
||||
errs := []string{}
|
||||
|
||||
cmd.Flags().VisitAll(func(f *pflag.Flag) {
|
||||
if !f.Changed {
|
||||
if !f.Changed || len(f.Annotations) == 0 {
|
||||
return
|
||||
}
|
||||
if !isVersionSupported(f, details.CurrentVersion()) {
|
||||
// Important: in the code below, calls to "details.CurrentVersion()" and
|
||||
// "details.ServerInfo()" are deliberately executed inline to make them
|
||||
// be executed "lazily". This is to prevent making a connection with the
|
||||
// daemon to perform a "ping" (even for flags that do not require a
|
||||
// daemon connection).
|
||||
//
|
||||
// See commit b39739123b845f872549e91be184cc583f5b387c for details.
|
||||
|
||||
if _, ok := f.Annotations["version"]; ok && !isVersionSupported(f, details.CurrentVersion()) {
|
||||
errs = append(errs, fmt.Sprintf(`"--%s" requires API version %s, but the Docker daemon API version is %s`, f.Name, getFlagAnnotation(f, "version"), details.CurrentVersion()))
|
||||
return
|
||||
}
|
||||
if !isOSTypeSupported(f, details.ServerInfo().OSType) {
|
||||
if _, ok := f.Annotations["ostype"]; ok && !isOSTypeSupported(f, details.ServerInfo().OSType) {
|
||||
errs = append(errs, fmt.Sprintf(
|
||||
`"--%s" is only supported on a Docker daemon running on %s, but the Docker daemon is running on %s`,
|
||||
f.Name,
|
||||
|
||||
@ -1142,7 +1142,10 @@ __docker_complete_user_group() {
|
||||
fi
|
||||
}
|
||||
|
||||
DOCKER_PLUGINS_PATH=$(docker info --format '{{range .ClientInfo.Plugins}}{{.Path}}:{{end}}')
|
||||
__docker_plugins_path() {
|
||||
local docker_plugins_path=$(docker info --format '{{range .ClientInfo.Plugins}}{{.Path}}:{{end}}')
|
||||
echo "${docker_plugins_path//:/ }"
|
||||
}
|
||||
|
||||
__docker_complete_plugin() {
|
||||
local path=$1
|
||||
@ -5504,7 +5507,7 @@ _docker() {
|
||||
# Create completion functions for all registered plugins
|
||||
local known_plugin_commands=()
|
||||
local plugin_name=""
|
||||
for plugin_path in ${DOCKER_PLUGINS_PATH//:/ }; do
|
||||
for plugin_path in $(__docker_plugins_path); do
|
||||
plugin_name=$(basename "$plugin_path" | sed 's/ *$//')
|
||||
plugin_name=${plugin_name#docker-}
|
||||
plugin_name=${plugin_name%%.*}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
variable "GO_VERSION" {
|
||||
default = "1.20.4"
|
||||
default = "1.20.10"
|
||||
}
|
||||
variable "VERSION" {
|
||||
default = ""
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG ALPINE_VERSION=3.16
|
||||
ARG ALPINE_VERSION=3.17
|
||||
|
||||
FROM alpine:${ALPINE_VERSION} AS gen
|
||||
RUN apk add --no-cache bash git
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GO_VERSION=1.20.4
|
||||
ARG ALPINE_VERSION=3.16
|
||||
ARG GO_VERSION=1.20.10
|
||||
ARG ALPINE_VERSION=3.17
|
||||
|
||||
ARG BUILDX_VERSION=0.10.4
|
||||
ARG BUILDX_VERSION=0.11.2
|
||||
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS golang
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOTOOLCHAIN=local
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
FROM golang AS gofumpt
|
||||
ARG GOFUMPT_VERSION=v0.4.0
|
||||
@ -18,7 +19,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
&& gofumpt --version
|
||||
|
||||
FROM golang AS gotestsum
|
||||
ARG GOTESTSUM_VERSION=v1.8.2
|
||||
ARG GOTESTSUM_VERSION=v1.10.0
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=tmpfs,target=/go/src/ \
|
||||
@ -48,11 +49,11 @@ CMD bash
|
||||
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
|
||||
ENV PATH=$PATH:/go/src/github.com/docker/cli/build
|
||||
|
||||
COPY --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
COPY --from=gofumpt /go/bin/* /go/bin/
|
||||
COPY --from=gotestsum /go/bin/* /go/bin/
|
||||
COPY --from=goversioninfo /go/bin/* /go/bin/
|
||||
COPY --link --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
COPY --link --from=gofumpt /go/bin/* /go/bin/
|
||||
COPY --link --from=gotestsum /go/bin/* /go/bin/
|
||||
COPY --link --from=goversioninfo /go/bin/* /go/bin/
|
||||
|
||||
WORKDIR /go/src/github.com/docker/cli
|
||||
ENV GO111MODULE=auto
|
||||
COPY . .
|
||||
COPY --link . .
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GO_VERSION=1.20.4
|
||||
ARG ALPINE_VERSION=3.16
|
||||
ARG GOLANGCI_LINT_VERSION=v1.52.2
|
||||
ARG GO_VERSION=1.20.10
|
||||
ARG ALPINE_VERSION=3.17
|
||||
ARG GOLANGCI_LINT_VERSION=v1.54.2
|
||||
|
||||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS lint
|
||||
ENV GOTOOLCHAIN=local
|
||||
ENV GO111MODULE=off
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOGC=75
|
||||
WORKDIR /go/src/github.com/docker/cli
|
||||
COPY --from=golangci-lint /usr/bin/golangci-lint /usr/bin/golangci-lint
|
||||
COPY --link --from=golangci-lint /usr/bin/golangci-lint /usr/bin/golangci-lint
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
golangci-lint run
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GO_VERSION=1.20.4
|
||||
ARG ALPINE_VERSION=3.16
|
||||
ARG GO_VERSION=1.20.10
|
||||
ARG ALPINE_VERSION=3.17
|
||||
ARG MODOUTDATED_VERSION=v0.8.0
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
|
||||
ENV GOTOOLCHAIN=local
|
||||
RUN apk add --no-cache bash git rsync
|
||||
WORKDIR /src
|
||||
|
||||
FROM base AS vendored
|
||||
ENV GOPROXY=direct
|
||||
ENV GOPROXY=https://proxy.golang.org|direct
|
||||
RUN --mount=target=/context \
|
||||
--mount=target=.,type=tmpfs \
|
||||
--mount=target=/go/pkg/mod,type=cache <<EOT
|
||||
|
||||
@ -9,11 +9,11 @@ Attach local standard input, output, and error streams to a running container
|
||||
|
||||
### Options
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:----------------|:---------|:--------|:----------------------------------------------------|
|
||||
| `--detach-keys` | `string` | | Override the key sequence for detaching a container |
|
||||
| `--no-stdin` | | | Do not attach STDIN |
|
||||
| `--sig-proxy` | | | Proxy all received signals to the process |
|
||||
| Name | Type | Default | Description |
|
||||
|:--------------------------------|:---------|:--------|:----------------------------------------------------|
|
||||
| [`--detach-keys`](#detach-keys) | `string` | | Override the key sequence for detaching a container |
|
||||
| `--no-stdin` | | | Do not attach STDIN |
|
||||
| `--sig-proxy` | | | Proxy all received signals to the process |
|
||||
|
||||
|
||||
<!---MARKER_GEN_END-->
|
||||
@ -56,30 +56,6 @@ performance critical applications that generate a lot of output in the
|
||||
foreground over a slow client connection. Instead, users should use the
|
||||
`docker logs` command to get access to the logs.
|
||||
|
||||
### Override the detach sequence
|
||||
|
||||
If you want, you can configure an override the Docker key sequence for detach.
|
||||
This is useful if the Docker default sequence conflicts with key sequence you
|
||||
use for other applications. There are two ways to define your own detach key
|
||||
sequence, as a per-container override or as a configuration property on your
|
||||
entire configuration.
|
||||
|
||||
To override the sequence for an individual container, use the
|
||||
`--detach-keys="<sequence>"` flag with the `docker attach` command. The format of
|
||||
the `<sequence>` is either a letter [a-Z], or the `ctrl-` combined with any of
|
||||
the following:
|
||||
|
||||
* `a-z` (a single lowercase alpha character )
|
||||
* `@` (at sign)
|
||||
* `[` (left bracket)
|
||||
* `\\` (two backward slashes)
|
||||
* `_` (underscore)
|
||||
* `^` (caret)
|
||||
|
||||
These `a`, `ctrl-a`, `X`, or `ctrl-\\` values are all examples of valid key
|
||||
sequences. To configure a different configuration default key sequence for all
|
||||
containers, see [**Configuration file** section](cli.md#configuration-files).
|
||||
|
||||
## Examples
|
||||
|
||||
### Attach to and detach from a running container
|
||||
@ -168,3 +144,27 @@ $ docker ps -a --filter name=test
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
a2fe3fd886db alpine "/bin/sh" About a minute ago Exited (13) 40 seconds ago test
|
||||
```
|
||||
|
||||
### <a name="detach-keys"></a> Override the detach sequence (--detach-keys)
|
||||
|
||||
Use the `--detach-keys` option to override the Docker key sequence for detach.
|
||||
This is useful if the Docker default sequence conflicts with key sequence you
|
||||
use for other applications. There are two ways to define your own detach key
|
||||
sequence, as a per-container override or as a configuration property on your
|
||||
entire configuration.
|
||||
|
||||
To override the sequence for an individual container, use the
|
||||
`--detach-keys="<sequence>"` flag with the `docker attach` command. The format of
|
||||
the `<sequence>` is either a letter [a-Z], or the `ctrl-` combined with any of
|
||||
the following:
|
||||
|
||||
* `a-z` (a single lowercase alpha character )
|
||||
* `@` (at sign)
|
||||
* `[` (left bracket)
|
||||
* `\\` (two backward slashes)
|
||||
* `_` (underscore)
|
||||
* `^` (caret)
|
||||
|
||||
These `a`, `ctrl-a`, `X`, or `ctrl-\\` values are all examples of valid key
|
||||
sequences. To configure a different configuration default key sequence for all
|
||||
containers, see [**Configuration file** section](cli.md#configuration-files).
|
||||
|
||||
@ -14,7 +14,7 @@ Build an image from a Dockerfile
|
||||
| [`--add-host`](#add-host) | `list` | | Add a custom host-to-IP mapping (`host:ip`) |
|
||||
| [`--build-arg`](#build-arg) | `list` | | Set build-time variables |
|
||||
| [`--cache-from`](#cache-from) | `stringSlice` | | Images to consider as cache sources |
|
||||
| [`--cgroup-parent`](#cgroup-parent) | `string` | | Optional parent cgroup for the container |
|
||||
| [`--cgroup-parent`](#cgroup-parent) | `string` | | Set the parent cgroup for the `RUN` instructions during build |
|
||||
| `--compress` | | | Compress the build context using gzip |
|
||||
| `--cpu-period` | `int64` | `0` | Limit the CPU CFS (Completely Fair Scheduler) period |
|
||||
| `--cpu-quota` | `int64` | `0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
|
||||
@ -458,7 +458,17 @@ You can add other hosts into a container's `/etc/hosts` file by using one or
|
||||
more `--add-host` flags. This example adds a static address for a host named
|
||||
`docker`:
|
||||
|
||||
$ docker build --add-host=docker:10.180.0.1 .
|
||||
```console
|
||||
$ docker build --add-host docker:10.180.0.1 .
|
||||
```
|
||||
|
||||
If you need your build to connect to services running on the host, you can use
|
||||
the special `host-gateway` value for `--add-host`. In the following example,
|
||||
build containers resolve `host.docker.internal` to the host's gateway IP.
|
||||
|
||||
```console
|
||||
$ docker build --add-host host.docker.internal:host-gateway .
|
||||
```
|
||||
|
||||
### <a name="target"></a> Specifying target build stage (--target)
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ Build an image from a Dockerfile
|
||||
| `--add-host` | `list` | | Add a custom host-to-IP mapping (`host:ip`) |
|
||||
| `--build-arg` | `list` | | Set build-time variables |
|
||||
| `--cache-from` | `stringSlice` | | Images to consider as cache sources |
|
||||
| `--cgroup-parent` | `string` | | Optional parent cgroup for the container |
|
||||
| `--cgroup-parent` | `string` | | Set the parent cgroup for the `RUN` instructions during build |
|
||||
| `--compress` | | | Compress the build context using gzip |
|
||||
| `--cpu-period` | `int64` | `0` | Limit the CPU CFS (Completely Fair Scheduler) period |
|
||||
| `--cpu-quota` | `int64` | `0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
|
||||
|
||||
@ -134,6 +134,7 @@ line:
|
||||
| `DOCKER_DEFAULT_PLATFORM` | Default platform for commands that take the `--platform` flag. |
|
||||
| `DOCKER_HIDE_LEGACY_COMMANDS` | When set, Docker hides "legacy" top-level commands (such as `docker rm`, and `docker pull`) in `docker help` output, and only `Management commands` per object-type (e.g., `docker container`) are printed. This may become the default in a future release. |
|
||||
| `DOCKER_HOST` | Daemon socket to connect to. |
|
||||
| `DOCKER_TLS` | Enable TLS for connections made by the `docker` CLI (equivalent of the `--tls` command-line option). Set to a non-empty value to enable TLS. Note that TLS is enabled automatically if any of the other TLS options are set. |
|
||||
| `DOCKER_TLS_VERIFY` | When set Docker uses TLS and verifies the remote. This variable is used both by the `docker` CLI and the [`dockerd` daemon](dockerd.md) |
|
||||
| `BUILDKIT_PROGRESS` | Set type of progress output (`auto`, `plain`, `tty`) when [building](build.md) with [BuildKit backend](https://docs.docker.com/build/buildkit/). Use plain to show container output (default `auto`). |
|
||||
|
||||
@ -240,7 +241,7 @@ credential store. When this property is set, `docker login` will attempt to
|
||||
store credentials in the binary specified by `docker-credential-<value>` which
|
||||
is visible on `$PATH`. If this property is not set, credentials will be stored
|
||||
in the `auths` property of the config. For more information, see the
|
||||
[**Credentials store** section in the `docker login` documentation](login.md#credentials-store)
|
||||
[**Credential stores** section in the `docker login` documentation](login.md#credential-stores)
|
||||
|
||||
The property `credHelpers` specifies a set of credential helpers to use
|
||||
preferentially over `credsStore` or `auths` when storing and retrieving
|
||||
|
||||
@ -20,7 +20,7 @@ Inspects the specified config.
|
||||
By default, this renders all results in a JSON array. If a format is specified,
|
||||
the given template will be executed for each result.
|
||||
|
||||
Go's [text/template](https://golang.org/pkg/text/template/) package
|
||||
Go's [text/template](https://pkg.go.dev/text/template) package
|
||||
describes all the details of the format.
|
||||
|
||||
For detailed information about using configs, refer to [store configuration data using Docker Configs](https://docs.docker.com/engine/swarm/configs/).
|
||||
|
||||
@ -828,36 +828,197 @@ Defaults to 20G.
|
||||
C:\> dockerd --storage-opt size=40G
|
||||
```
|
||||
|
||||
### Docker runtime execution options
|
||||
### Runtime options
|
||||
|
||||
The Docker daemon relies on a
|
||||
[OCI](https://github.com/opencontainers/runtime-spec) compliant runtime
|
||||
(invoked via the `containerd` daemon) as its interface to the Linux
|
||||
kernel `namespaces`, `cgroups`, and `SELinux`.
|
||||
|
||||
By default, the Docker daemon automatically starts `containerd`. If you want to
|
||||
control `containerd` startup, manually start `containerd` and pass the path to
|
||||
the `containerd` socket using the `--containerd` flag. For example:
|
||||
#### Configure container runtimes
|
||||
|
||||
By default, the Docker daemon uses runc as a container runtime.
|
||||
You can configure the daemon to add additional runtimes.
|
||||
|
||||
containerd shims installed on `PATH` can be used directly, without the need
|
||||
to edit the daemon's configuration. For example, if you install the Kata
|
||||
Containers shim (`containerd-shim-kata-v2`) on `PATH`, then you can select that
|
||||
runtime with `docker run` without having to edit the daemon's configuration:
|
||||
|
||||
```console
|
||||
$ sudo dockerd --containerd /var/run/dev/docker-containerd.sock
|
||||
$ docker run --runtime io.containerd.kata.v2
|
||||
```
|
||||
|
||||
Runtimes can be registered with the daemon either via the
|
||||
configuration file or using the `--add-runtime` command line argument.
|
||||
Container runtimes that don't implement containerd shims, or containerd shims
|
||||
installed outside of `PATH`, must be registered with the daemon, either via the
|
||||
configuration file or using the `--add-runtime` command line flag.
|
||||
|
||||
The following is an example adding 2 runtimes via the configuration:
|
||||
For examples on how to use other container runtimes, see
|
||||
[Alternative container runtimes](https://docs.docker.com/engine/alternative-runtimes/)
|
||||
|
||||
##### Configure runtimes using `daemon.json`
|
||||
|
||||
To register and configure container runtimes using the daemon's configuration
|
||||
file, add the runtimes as entries under `runtimes`:
|
||||
|
||||
```json
|
||||
{
|
||||
"default-runtime": "runc",
|
||||
"runtimes": {
|
||||
"custom": {
|
||||
"path": "/usr/local/bin/my-runc-replacement",
|
||||
"runtimeArgs": [
|
||||
"--debug"
|
||||
]
|
||||
"<runtime>": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The key of the entry (`<runtime>` in the previous example) represents the name
|
||||
of the runtime. This is the name that you reference when you run a container,
|
||||
using `docker run --runtime <runtime>`.
|
||||
|
||||
The runtime entry contains an object specifying the configuration for your
|
||||
runtime. The properties of the object depends on what kind of runtime you're
|
||||
looking to register:
|
||||
|
||||
- If the runtime implements its own containerd shim, the object shall contain
|
||||
a `runtimeType` field and an optional `options` field.
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"<runtime>": {
|
||||
"runtimeType": "<name-or-path>",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See [Configure shims](#configure-containerd-shims).
|
||||
|
||||
- If the runtime is designed to be a drop-in replacement for runc,
|
||||
the object contains a `path` field, and an optional `runtimeArgs` field.
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"<runtime>": {
|
||||
"path": "/path/to/bin",
|
||||
"runtimeArgs": ["...args"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See [Configure runc drop-in replacements](#configure-runc-drop-in-replacements).
|
||||
|
||||
After changing the runtimes configuration in the configuration file,
|
||||
you must reload or restart the daemon for changes to take effect:
|
||||
|
||||
```console
|
||||
$ sudo systemctl reload dockerd
|
||||
```
|
||||
|
||||
##### Configure containerd shims
|
||||
|
||||
If the runtime that you want to register implements a containerd shim,
|
||||
or if you want to register a runtime which uses the runc shim,
|
||||
use the following format for the runtime entry:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"<runtime>": {
|
||||
"runtimeType": "<name-or-path>",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`runtimeType` refers to either:
|
||||
|
||||
- A fully qualified name of a containerd shim.
|
||||
|
||||
The fully qualified name of a shim is the same as the `runtime_type` used to
|
||||
register the runtime in containerd's CRI configuration.
|
||||
For example, `io.containerd.runsc.v1`.
|
||||
|
||||
- The path of a containerd shim binary.
|
||||
|
||||
This option is useful if you installed the containerd shim binary outside of
|
||||
`PATH`.
|
||||
|
||||
`options` is optional. It lets you specify the runtime configuration that you
|
||||
want to use for the shim. The configuration parameters that you can specify in
|
||||
`options` depends on the runtime you're registering. For most shims,
|
||||
the supported configuration options are `TypeUrl` and `ConfigPath`.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"gvisor": {
|
||||
"runtimeType": "io.containerd.runsc.v1",
|
||||
"options": {
|
||||
"TypeUrl": "io.containerd.runsc.v1.options",
|
||||
"ConfigPath": "/etc/containerd/runsc.toml",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can configure multiple runtimes using the same runtimeType. For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"gvisor-foo": {
|
||||
"runtimeType": "io.containerd.runsc.v1",
|
||||
"options": {
|
||||
"TypeUrl": "io.containerd.runsc.v1.options",
|
||||
"ConfigPath": "/etc/containerd/runsc-foo.toml"
|
||||
}
|
||||
},
|
||||
"gvisor-bar": {
|
||||
"runtimeType": "io.containerd.runsc.v1",
|
||||
"options": {
|
||||
"TypeUrl": "io.containerd.runsc.v1.options",
|
||||
"ConfigPath": "/etc/containerd/runsc-bar.toml"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `options` field takes a special set of configuration parameters when used
|
||||
with `"runtimeType": "io.containerd.runc.v2"`. For more information about runc
|
||||
parameters, refer to the runc configuration section in
|
||||
[CRI Plugin Config Guide](https://github.com/containerd/containerd/blob/v1.7.2/docs/cri/config.md#full-configuration).
|
||||
|
||||
##### Configure runc drop-in replacements
|
||||
|
||||
If the runtime that you want to register can act as a drop-in replacement for
|
||||
runc, you can register the runtime either using the daemon configuration file,
|
||||
or using the `--add-runtime` flag for the `dockerd` cli.
|
||||
|
||||
When you use the configuration file, the entry uses the following format:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"<runtime>": {
|
||||
"path": "/path/to/binary",
|
||||
"runtimeArgs": ["...args"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where `path` is either the absolute path to the runtime executable, or the name
|
||||
of an executable installed on `PATH`:
|
||||
|
||||
```json
|
||||
{
|
||||
"runtimes": {
|
||||
"runc": {
|
||||
"path": "runc"
|
||||
}
|
||||
@ -865,24 +1026,58 @@ The following is an example adding 2 runtimes via the configuration:
|
||||
}
|
||||
```
|
||||
|
||||
This is the same example via the command line:
|
||||
And `runtimeArgs` lets you optionally pass additional arguments to the runtime.
|
||||
Entries with this format use the containerd runc shim to invoke a custom
|
||||
runtime binary.
|
||||
|
||||
When you use the `--add-runtime` CLI flag, use the following format:
|
||||
|
||||
```console
|
||||
$ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-runc-replacement
|
||||
$ sudo dockerd --add-runtime <runtime>=<path>
|
||||
```
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> Defining runtime arguments via the command line is not supported.
|
||||
Defining runtime arguments via the command line is not supported.
|
||||
|
||||
#### Options for the runtime
|
||||
For an example configuration for a runc drop-in replacment, see
|
||||
[Alternative container runtimes > youki](https://docs.docker.com/engine/alternative-runtimes/#youki)
|
||||
|
||||
You can configure the runtime using options specified
|
||||
with the `--exec-opt` flag. All the flag's options have the `native` prefix. A
|
||||
single `native.cgroupdriver` option is available.
|
||||
##### Configure the default container runtime
|
||||
|
||||
The `native.cgroupdriver` option specifies the management of the container's
|
||||
cgroups. You can only specify `cgroupfs` or `systemd`. If you specify
|
||||
You can specify either the name of a fully qualified containerd runtime shim,
|
||||
or the name of a registered runtime. You can specify the default runtime either
|
||||
using the daemon configuration file, or using the `--default-runtime` flag for
|
||||
the `dockerd` cli.
|
||||
|
||||
When you use the configuration file, the entry uses the following format:
|
||||
|
||||
```json
|
||||
{
|
||||
"default-runtime": "io.containerd.runsc.v1"
|
||||
}
|
||||
```
|
||||
|
||||
When you use the `--default-runtime` CLI flag, use the following format:
|
||||
|
||||
```console
|
||||
$ dockerd --default-runtime io.containerd.runsc.v1
|
||||
```
|
||||
|
||||
#### Run containerd standalone
|
||||
|
||||
By default, the Docker daemon automatically starts `containerd`. If you want to
|
||||
control `containerd` startup, manually start `containerd` and pass the path to
|
||||
the `containerd` socket using the `--containerd` flag. For example:
|
||||
|
||||
```console
|
||||
$ sudo dockerd --containerd /run/containerd/containerd.sock
|
||||
```
|
||||
|
||||
#### Configure cgroup driver
|
||||
|
||||
You can configure how the runtime should manage container cgroups, using the
|
||||
`--exec-opt native.cgroupdriver` CLI flag.
|
||||
|
||||
You can only specify `cgroupfs` or `systemd`. If you specify
|
||||
`systemd` and it is not available, the system errors out. If you omit the
|
||||
`native.cgroupdriver` option,` cgroupfs` is used on cgroup v1 hosts, `systemd`
|
||||
is used on cgroup v2 hosts with systemd available.
|
||||
@ -895,16 +1090,19 @@ $ sudo dockerd --exec-opt native.cgroupdriver=systemd
|
||||
|
||||
Setting this option applies to all containers the daemon launches.
|
||||
|
||||
Also Windows Container makes use of `--exec-opt` for special purpose. Docker user
|
||||
can specify default container isolation technology with this, for example:
|
||||
#### Configure container isolation technology (Windows)
|
||||
|
||||
For Windows containers, you can specify the default container isolation
|
||||
technology to use, using the `--exec-opt isolation` flag.
|
||||
|
||||
The following example makes `hyperv` the default isolation technology:
|
||||
|
||||
```console
|
||||
> dockerd --exec-opt isolation=hyperv
|
||||
```
|
||||
|
||||
Will make `hyperv` the default isolation technology on Windows. If no isolation
|
||||
value is specified on daemon start, on Windows client, the default is
|
||||
`hyperv`, and on Windows server, the default is `process`.
|
||||
If no isolation value is specified on daemon start, on Windows client,
|
||||
the default is `hyperv`, and on Windows server, the default is `process`.
|
||||
|
||||
### Daemon DNS options
|
||||
|
||||
@ -1067,6 +1265,25 @@ the host.
|
||||
For details about how to use this feature, as well as limitations, see
|
||||
[Isolate containers with a user namespace](https://docs.docker.com/engine/security/userns-remap/).
|
||||
|
||||
### Configure host gateway IP
|
||||
|
||||
The Docker daemon supports a special `host-gateway` value for the `--add-host`
|
||||
flag for the `docker run` and `docker build` commands. This value resolves to
|
||||
the host's gateway IP and lets containers connect to services running on the
|
||||
host.
|
||||
|
||||
By default, `host-gateway` resolves to the IP address of the default bridge.
|
||||
You can configure this to resolve to a different IP using the `--host-gateway-ip`
|
||||
flag for the dockerd command line interface, or the `host-gateway-ip` key in
|
||||
the daemon configuration file.
|
||||
|
||||
```console
|
||||
$ dockerd --host-gateway-ip 192.0.2.0
|
||||
$ docker run -it --add-host host.docker.internal:host-gateway \
|
||||
busybox ping host.docker.internal
|
||||
PING host.docker.internal (192.0.2.0): 56 data bytes
|
||||
```
|
||||
|
||||
### Miscellaneous options
|
||||
|
||||
IP masquerading uses address translation to allow containers without a public
|
||||
|
||||
@ -9,12 +9,12 @@ Get real time events from the server
|
||||
|
||||
### Options
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:----------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format the output using the given Go template |
|
||||
| [`--since`](#since) | `string` | | Show all events created since timestamp |
|
||||
| `--until` | `string` | | Stream events until this timestamp |
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| [`--since`](#since) | `string` | | Show all events created since timestamp |
|
||||
| `--until` | `string` | | Stream events until this timestamp |
|
||||
|
||||
|
||||
<!---MARKER_GEN_END-->
|
||||
@ -194,7 +194,7 @@ The currently supported filters are:
|
||||
|
||||
If a format (`--format`) is specified, the given template will be executed
|
||||
instead of the default
|
||||
format. Go's [text/template](https://golang.org/pkg/text/template/) package
|
||||
format. Go's [text/template](https://pkg.go.dev/text/template) package
|
||||
describes all the details of the format.
|
||||
|
||||
If a format is set to `{{json .}}`, the events are streamed as valid JSON
|
||||
@ -401,8 +401,11 @@ Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299
|
||||
|
||||
#### Format as JSON
|
||||
|
||||
To list events in JSON format, use the `json` directive, which is the equivalent
|
||||
of `--format '{{ json . }}`.
|
||||
|
||||
```console
|
||||
$ docker events --format '{{json .}}'
|
||||
$ docker events --format json
|
||||
|
||||
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
{"status":"attach","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
@ -410,3 +413,5 @@ $ docker events --format '{{json .}}'
|
||||
{"status":"start","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f42..
|
||||
{"status":"resize","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
```
|
||||
|
||||
.
|
||||
|
||||
@ -14,7 +14,7 @@ Build an image from a Dockerfile
|
||||
| `--add-host` | `list` | | Add a custom host-to-IP mapping (`host:ip`) |
|
||||
| `--build-arg` | `list` | | Set build-time variables |
|
||||
| `--cache-from` | `stringSlice` | | Images to consider as cache sources |
|
||||
| `--cgroup-parent` | `string` | | Optional parent cgroup for the container |
|
||||
| `--cgroup-parent` | `string` | | Set the parent cgroup for the `RUN` instructions during build |
|
||||
| `--compress` | | | Compress the build context using gzip |
|
||||
| `--cpu-period` | `int64` | `0` | Limit the CPU CFS (Completely Fair Scheduler) period |
|
||||
| `--cpu-quota` | `int64` | `0` | Limit the CPU CFS (Completely Fair Scheduler) quota |
|
||||
|
||||
@ -101,7 +101,7 @@ read the [`dockerd`](dockerd.md) reference page.
|
||||
| [volume create](volume_create.md) | Creates a new volume where containers can consume and store data |
|
||||
| [volume inspect](volume_inspect.md) | Display information about a volume |
|
||||
| [volume ls](volume_ls.md) | Lists all the volumes Docker knows about |
|
||||
| [volume prune](volume_prune.md) | Remove all unused local volumes |
|
||||
| [volume prune](volume_prune.md) | Remove unused local volumes |
|
||||
| [volume rm](volume_rm.md) | Remove one or more volumes |
|
||||
|
||||
### Swarm node commands
|
||||
|
||||
@ -24,7 +24,7 @@ The number of images shown is the number of unique images. The same image tagged
|
||||
under different names is counted only once.
|
||||
|
||||
If a format is specified, the given template will be executed instead of the
|
||||
default format. Go's [text/template](https://golang.org/pkg/text/template/) package
|
||||
default format. Go's [text/template](https://pkg.go.dev/text/template) package
|
||||
describes all the details of the format.
|
||||
|
||||
Depending on the storage driver in use, additional information can be shown, such
|
||||
|
||||
@ -24,7 +24,7 @@ By default, `docker inspect` will render results in a JSON array.
|
||||
|
||||
If a format is specified, the given template will be executed for each result.
|
||||
|
||||
Go's [text/template](https://golang.org/pkg/text/template/) package describes
|
||||
Go's [text/template](https://pkg.go.dev/text/template) package describes
|
||||
all the details of the format.
|
||||
|
||||
### <a name="type"></a> Specify target type (--type)
|
||||
|
||||
@ -56,27 +56,28 @@ credentials. When you log in, the command stores credentials in
|
||||
`$HOME/.docker/config.json` on Linux or `%USERPROFILE%/.docker/config.json` on
|
||||
Windows, via the procedure described below.
|
||||
|
||||
### Credentials store
|
||||
### Credential stores
|
||||
|
||||
The Docker Engine can keep user credentials in an external credentials store,
|
||||
The Docker Engine can keep user credentials in an external credential store,
|
||||
such as the native keychain of the operating system. Using an external store
|
||||
is more secure than storing credentials in the Docker configuration file.
|
||||
|
||||
To use a credentials store, you need an external helper program to interact
|
||||
To use a credential store, you need an external helper program to interact
|
||||
with a specific keychain or external store. Docker requires the helper
|
||||
program to be in the client's host `$PATH`.
|
||||
|
||||
This is the list of currently available credentials helpers and where
|
||||
you can download them from:
|
||||
You can download the helpers from the `docker-credential-helpers`
|
||||
[releases page](https://github.com/docker/docker-credential-helpers/releases).
|
||||
Helpers are available for the following credential stores:
|
||||
|
||||
- D-Bus Secret Service: https://github.com/docker/docker-credential-helpers/releases
|
||||
- Apple macOS keychain: https://github.com/docker/docker-credential-helpers/releases
|
||||
- Microsoft Windows Credential Manager: https://github.com/docker/docker-credential-helpers/releases
|
||||
- [pass](https://www.passwordstore.org/): https://github.com/docker/docker-credential-helpers/releases
|
||||
- D-Bus Secret Service
|
||||
- Apple macOS keychain
|
||||
- Microsoft Windows Credential Manager
|
||||
- [pass](https://www.passwordstore.org/)
|
||||
|
||||
#### Configure the credentials store
|
||||
#### Configure the credential store
|
||||
|
||||
You need to specify the credentials store in `$HOME/.docker/config.json`
|
||||
You need to specify the credential store in `$HOME/.docker/config.json`
|
||||
to tell the docker engine to use it. The value of the config property should be
|
||||
the suffix of the program to use (i.e. everything after `docker-credential-`).
|
||||
For example, to use `docker-credential-osxkeychain`:
|
||||
|
||||
@ -34,7 +34,7 @@ the container's `STDOUT` and `STDERR`.
|
||||
Passing a negative number or a non-integer to `--tail` is invalid and the
|
||||
value is set to `all` in that case.
|
||||
|
||||
The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
|
||||
The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://pkg.go.dev/time#RFC3339Nano)
|
||||
, for example `2014-09-16T06:17:46.000000000Z`, to each
|
||||
log entry. To ensure that the timestamps are aligned the
|
||||
nano-second part of the timestamp will be padded with zero when necessary.
|
||||
|
||||
@ -41,7 +41,7 @@ node are shown.
|
||||
|
||||
You can specify an alternate format to execute a given
|
||||
template for each result. Go's
|
||||
[text/template](https://golang.org/pkg/text/template/) package describes all the
|
||||
[text/template](https://pkg.go.dev/text/template) package describes all the
|
||||
details of the format.
|
||||
|
||||
```console
|
||||
|
||||
@ -18,7 +18,7 @@ Display detailed information on one or more nodes
|
||||
Returns information about a node. By default, this command renders all results
|
||||
in a JSON array. You can specify an alternate format to execute a
|
||||
given template for each result. Go's
|
||||
[text/template](https://golang.org/pkg/text/template/) package describes all the
|
||||
[text/template](https://pkg.go.dev/text/template) package describes all the
|
||||
details of the format.
|
||||
|
||||
> **Note**
|
||||
|
||||
@ -174,9 +174,19 @@ Any of these events result in a `137` status:
|
||||
|
||||
#### status
|
||||
|
||||
The `status` filter matches containers by status. You can filter using
|
||||
`created`, `restarting`, `running`, `removing`, `paused`, `exited` and `dead`. For example,
|
||||
to filter for `running` containers:
|
||||
The `status` filter matches containers by status. The possible values for the container status are:
|
||||
|
||||
| Status | Description |
|
||||
| :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `created` | A container that has never been started. |
|
||||
| `running` | A running container, started by either `docker start` or `docker run`. |
|
||||
| `paused` | A paused container. See `docker pause`. |
|
||||
| `restarting` | A container which is starting due to the designated restart policy for that container. |
|
||||
| `exited` | A container which is no longer running. For example, the process inside the container completed or the container was stopped using the `docker stop` command. |
|
||||
| `removing` | A container which is in the process of being removed. See `docker rm`. |
|
||||
| `dead` | A "defunct" container; for example, a container that was only partially removed because resources were kept busy by an external process. `dead` containers cannot be (re)started, only removed. |
|
||||
|
||||
For example, to filter for `running` containers:
|
||||
|
||||
```console
|
||||
$ docker ps --filter status=running
|
||||
|
||||
@ -32,7 +32,7 @@ Create and run a new container from an image
|
||||
| `--cpuset-cpus` | `string` | | CPUs in which to allow execution (0-3, 0,1) |
|
||||
| `--cpuset-mems` | `string` | | MEMs in which to allow execution (0-3, 0,1) |
|
||||
| `-d`, `--detach` | | | Run container in background and print container ID |
|
||||
| `--detach-keys` | `string` | | Override the key sequence for detaching a container |
|
||||
| [`--detach-keys`](#detach-keys) | `string` | | Override the key sequence for detaching a container |
|
||||
| [`--device`](#device) | `list` | | Add a host device to the container |
|
||||
| [`--device-cgroup-rule`](#device-cgroup-rule) | `list` | | Add a rule to the cgroup allowed devices list |
|
||||
| `--device-read-bps` | `list` | | Limit read rate (bytes per second) from a device |
|
||||
@ -485,10 +485,12 @@ $ docker run -itd --network=my-net busybox
|
||||
```
|
||||
|
||||
You can also choose the IP addresses for the container with `--ip` and `--ip6`
|
||||
flags when you start the container on a user-defined network.
|
||||
flags when you start the container on a user-defined network. To assign a
|
||||
static IP to containers, you must specify subnet block for the network.
|
||||
|
||||
```console
|
||||
$ docker run -itd --network=my-net --ip=10.10.9.75 busybox
|
||||
$ docker network create --subnet 192.0.2.0/24 my-net
|
||||
$ docker run -itd --network=my-net --ip=192.0.2.69 busybox
|
||||
```
|
||||
|
||||
If you want to add a running container to a network use the `docker network connect` subcommand.
|
||||
@ -569,6 +571,30 @@ retrieve the container's ID once the container has finished running.
|
||||
|
||||
See also [the `docker cp` command](cp.md).
|
||||
|
||||
### <a name="detach-keys"></a> Override the detach sequence (--detach-keys)
|
||||
|
||||
Use the `--detach-keys` option to override the Docker key sequence for detach.
|
||||
This is useful if the Docker default sequence conflicts with key sequence you
|
||||
use for other applications. There are two ways to define your own detach key
|
||||
sequence, as a per-container override or as a configuration property on your
|
||||
entire configuration.
|
||||
|
||||
To override the sequence for an individual container, use the
|
||||
`--detach-keys="<sequence>"` flag with the `docker attach` command. The format of
|
||||
the `<sequence>` is either a letter [a-Z], or the `ctrl-` combined with any of
|
||||
the following:
|
||||
|
||||
* `a-z` (a single lowercase alpha character )
|
||||
* `@` (at sign)
|
||||
* `[` (left bracket)
|
||||
* `\\` (two backward slashes)
|
||||
* `_` (underscore)
|
||||
* `^` (caret)
|
||||
|
||||
These `a`, `ctrl-a`, `X`, or `ctrl-\\` values are all examples of valid key
|
||||
sequences. To configure a different configuration default key sequence for all
|
||||
containers, see [**Configuration file** section](cli.md#configuration-files).
|
||||
|
||||
### <a name="device"></a> Add host device to container (--device)
|
||||
|
||||
```console
|
||||
@ -733,24 +759,28 @@ PING docker (93.184.216.34): 56 data bytes
|
||||
round-trip min/avg/max = 92.209/92.495/93.052 ms
|
||||
```
|
||||
|
||||
Sometimes you need to connect to the Docker host from within your
|
||||
container. To enable this, pass the Docker host's IP address to
|
||||
the container using the `--add-host` flag. To find the host's address,
|
||||
use the `ip addr show` command.
|
||||
The `--add-host` flag supports a special `host-gateway` value that resolves to
|
||||
the internal IP address of the host. This is useful when you want containers to
|
||||
connect to services running on the host machine.
|
||||
|
||||
The flags you pass to `ip addr show` depend on whether you are
|
||||
using IPv4 or IPv6 networking in your containers. Use the following
|
||||
flags for IPv4 address retrieval for a network device named `eth0`:
|
||||
It's conventional to use `host.docker.internal` as the hostname referring to
|
||||
`host-gateway`. Docker Desktop automatically resolves this hostname, see
|
||||
[Explore networking features](https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host).
|
||||
|
||||
The following example shows how the special `host-gateway` value works. The
|
||||
example runs an HTTP server that serves a file from host to container over the
|
||||
`host.docker.internal` hostname, which resolves to the host's internal IP.
|
||||
|
||||
```console
|
||||
$ HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print $2}' | cut -d / -f 1 | sed -n 1p`
|
||||
$ docker run --add-host=docker:${HOSTIP} --rm -it debian
|
||||
$ echo "hello from host!" > ./hello
|
||||
$ python3 -m http.server 8000
|
||||
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
|
||||
$ docker run \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
curlimages/curl -s host.docker.internal:8000/hello
|
||||
hello from host!
|
||||
```
|
||||
|
||||
For IPv6 use the `-6` flag instead of the `-4` flag. For other network
|
||||
devices, replace `eth0` with the correct device name (for example `docker0`
|
||||
for the bridge device).
|
||||
|
||||
### <a name="ulimit"></a> Set ulimits in container (--ulimit)
|
||||
|
||||
Since setting `ulimit` settings in a container requires extra privileges not
|
||||
@ -948,4 +978,4 @@ The `docker run` command is equivalent to the following API calls:
|
||||
- If that call returns a 404 (image not found), and depending on the `--pull` option ("always", "missing", "never") the call can trigger a `docker pull <image>`.
|
||||
- `/containers/create` again after pulling the image.
|
||||
- `/containers/(id)/start` to start the container.
|
||||
- `/containers/(id)/attach` to attach to the container when starting with the `-it` flags for interactive containers.
|
||||
- `/containers/(id)/attach` to attach to the container when starting with the `-it` flags for interactive containers.
|
||||
|
||||
@ -20,7 +20,7 @@ Inspects the specified secret.
|
||||
By default, this renders all results in a JSON array. If a format is specified,
|
||||
the given template will be executed for each result.
|
||||
|
||||
Go's [text/template](https://golang.org/pkg/text/template/) package
|
||||
Go's [text/template](https://pkg.go.dev/text/template) package
|
||||
describes all the details of the format.
|
||||
|
||||
For detailed information about using secrets, refer to [manage sensitive data with Docker secrets](https://docs.docker.com/engine/swarm/secrets/).
|
||||
|
||||
@ -916,7 +916,7 @@ $ docker service create \
|
||||
The swarm extends my-network to each node running the service.
|
||||
|
||||
Containers on the same network can access each other using
|
||||
[service discovery](https://docs.docker.com/network/overlay/#container-discovery).
|
||||
[service discovery](https://docs.docker.com/network/drivers/overlay/#container-discovery).
|
||||
|
||||
Long form syntax of `--network` allows to specify list of aliases and driver options:
|
||||
`--network name=my-network,alias=web1,driver-opt=field1=value1`
|
||||
@ -1013,7 +1013,7 @@ registry value must be located in:
|
||||
### Create services using templates
|
||||
|
||||
You can use templates for some flags of `service create`, using the syntax
|
||||
provided by the Go's [text/template](https://golang.org/pkg/text/template/) package.
|
||||
provided by the Go's [text/template](https://pkg.go.dev/text/template) package.
|
||||
|
||||
The supported flags are the following :
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ Inspects the specified service.
|
||||
By default, this renders all results in a JSON array. If a format is specified,
|
||||
the given template will be executed for each result.
|
||||
|
||||
Go's [text/template](https://golang.org/pkg/text/template/) package
|
||||
Go's [text/template](https://pkg.go.dev/text/template) package
|
||||
describes all the details of the format.
|
||||
|
||||
> **Note**
|
||||
|
||||
@ -50,7 +50,7 @@ the service's `STDOUT` and `STDERR`.
|
||||
Passing a negative number or a non-integer to `--tail` is invalid and the
|
||||
value is set to `all` in that case.
|
||||
|
||||
The `docker service logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
|
||||
The `docker service logs --timestamps` command will add an [RFC3339Nano timestamp](https://pkg.go.dev/time#RFC3339Nano)
|
||||
, for example `2014-09-16T06:17:46.000000000Z`, to each
|
||||
log entry. To ensure that the timestamps are aligned the
|
||||
nano-second part of the timestamp will be padded with zero when necessary.
|
||||
|
||||
@ -5,13 +5,12 @@ Manage Docker
|
||||
|
||||
### Subcommands
|
||||
|
||||
| Name | Description |
|
||||
|:-------------------------------------|:---------------------------------------------------------------------------------|
|
||||
| [`df`](system_df.md) | Show docker disk usage |
|
||||
| [`dial-stdio`](system_dial-stdio.md) | Proxy the stdio stream to the daemon connection. Should not be invoked manually. |
|
||||
| [`events`](system_events.md) | Get real time events from the server |
|
||||
| [`info`](system_info.md) | Display system-wide information |
|
||||
| [`prune`](system_prune.md) | Remove unused data |
|
||||
| Name | Description |
|
||||
|:-----------------------------|:-------------------------------------|
|
||||
| [`df`](system_df.md) | Show docker disk usage |
|
||||
| [`events`](system_events.md) | Get real time events from the server |
|
||||
| [`info`](system_info.md) | Display system-wide information |
|
||||
| [`prune`](system_prune.md) | Remove unused data |
|
||||
|
||||
|
||||
|
||||
|
||||
@ -9,12 +9,12 @@ Get real time events from the server
|
||||
|
||||
### Options
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:----------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format the output using the given Go template |
|
||||
| `--since` | `string` | | Show all events created since timestamp |
|
||||
| `--until` | `string` | | Stream events until this timestamp |
|
||||
| Name | Type | Default | Description |
|
||||
|:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [`-f`](#filter), [`--filter`](#filter) | `filter` | | Filter output based on conditions provided |
|
||||
| [`--format`](#format) | `string` | | Format output using a custom template:<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
|
||||
| `--since` | `string` | | Show all events created since timestamp |
|
||||
| `--until` | `string` | | Stream events until this timestamp |
|
||||
|
||||
|
||||
<!---MARKER_GEN_END-->
|
||||
@ -308,7 +308,7 @@ $ docker system events --filter 'type=plugin'
|
||||
### <a name="format"></a> Format the output (--format)
|
||||
|
||||
If a format (`--format`) is specified, the given template will be executed
|
||||
instead of the default format. Go's [text/template](https://golang.org/pkg/text/template/)
|
||||
instead of the default format. Go's [text/template](https://pkg.go.dev/text/template)
|
||||
package describes all the details of the format.
|
||||
|
||||
```console
|
||||
|
||||
@ -10,7 +10,7 @@ Remove unused data
|
||||
| `-a`, `--all` | | | Remove all unused images not just dangling ones |
|
||||
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `label=<key>=<value>`) |
|
||||
| `-f`, `--force` | | | Do not prompt for confirmation |
|
||||
| `--volumes` | | | Prune volumes |
|
||||
| `--volumes` | | | Prune anonymous volumes |
|
||||
|
||||
|
||||
<!---MARKER_GEN_END-->
|
||||
@ -50,7 +50,7 @@ Total reclaimed space: 1.84kB
|
||||
|
||||
By default, volumes are not removed to prevent important data from being
|
||||
deleted if there is currently no container using the volume. Use the `--volumes`
|
||||
flag when running the command to prune volumes as well:
|
||||
flag when running the command to prune anonymous volumes as well:
|
||||
|
||||
```console
|
||||
$ docker system prune -a --volumes
|
||||
@ -58,7 +58,7 @@ $ docker system prune -a --volumes
|
||||
WARNING! This will remove:
|
||||
- all stopped containers
|
||||
- all networks not used by at least one container
|
||||
- all volumes not used by at least one container
|
||||
- all anonymous volumes not used by at least one container
|
||||
- all images without at least one container associated to them
|
||||
- all build cache
|
||||
Are you sure you want to continue? [y/N] y
|
||||
|
||||
@ -23,7 +23,7 @@ registry at `registry-1.docker.io` by default. Note that `docker.io` is the
|
||||
canonical reference for Docker's public registry.
|
||||
- `PORT_NUMBER`: If a hostname is present, it may optionally be followed by a
|
||||
registry port number in the format `:8080`.
|
||||
- `PATH`: The path consists consists of slash-separated components. Each
|
||||
- `PATH`: The path consists of slash-separated components. Each
|
||||
component may contain lowercase letters, digits and separators. A separator is
|
||||
defined as a period, one or two underscores, or one or more hyphens. A component
|
||||
may not start or end with a separator. While the
|
||||
|
||||
@ -10,7 +10,7 @@ Manage volumes
|
||||
| [`create`](volume_create.md) | Create a volume |
|
||||
| [`inspect`](volume_inspect.md) | Display detailed information on one or more volumes |
|
||||
| [`ls`](volume_ls.md) | List volumes |
|
||||
| [`prune`](volume_prune.md) | Remove all unused local volumes |
|
||||
| [`prune`](volume_prune.md) | Remove unused local volumes |
|
||||
| [`rm`](volume_rm.md) | Remove one or more volumes |
|
||||
| [`update`](volume_update.md) | Update a volume (cluster volumes only) |
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ Display detailed information on one or more volumes
|
||||
Returns information about a volume. By default, this command renders all results
|
||||
in a JSON array. You can specify an alternate format to execute a
|
||||
given template for each result. Go's
|
||||
[text/template](https://golang.org/pkg/text/template/) package describes all the
|
||||
[text/template](https://pkg.go.dev/text/template) package describes all the
|
||||
details of the format.
|
||||
|
||||
## Examples
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# volume prune
|
||||
|
||||
<!---MARKER_GEN_START-->
|
||||
Remove all unused local volumes
|
||||
Remove unused local volumes
|
||||
|
||||
### Options
|
||||
|
||||
|
||||
@ -672,7 +672,7 @@ the container exits**, you can add the `--rm` flag:
|
||||
> ```console
|
||||
> $ docker run --rm -v /foo -v awesome:/bar busybox top
|
||||
> ```
|
||||
>
|
||||
>
|
||||
> the volume for `/foo` will be removed, but the volume for `/bar` will not.
|
||||
> Volumes inherited via `--volumes-from` will be removed with the same logic: if
|
||||
> the original volume was specified with a name it will **not** be removed.
|
||||
@ -1418,7 +1418,7 @@ container's logging driver. The following options are supported:
|
||||
| `fluentd` | Fluentd logging driver for Docker. Writes log messages to `fluentd` (forward input). |
|
||||
| `awslogs` | Amazon CloudWatch Logs logging driver for Docker. Writes log messages to Amazon CloudWatch Logs. |
|
||||
| `splunk` | Splunk logging driver for Docker. Writes log messages to `splunk` using Event Http Collector. |
|
||||
| `etwlogs` | Event Tracing for Windows (ETW) events. Writes log messages as Event Tracing for Windows (ETW) events. Only Windows platforms. |
|
||||
| `etwlogs` | Event Tracing for Windows (ETW) events. Writes log messages as Event Tracing for Windows (ETW) events. Only Windows platforms. |
|
||||
| `gcplogs` | Google Cloud Platform (GCP) Logging. Writes log messages to Google Cloud Platform (GCP) Logging. |
|
||||
| `logentries` | Rapid7 Logentries. Writes log messages to Rapid7 Logentries. |
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
engine:
|
||||
build:
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
engine:
|
||||
command: ["--insecure-registry=registry:5000", "--experimental"]
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
registry:
|
||||
image: 'registry:2'
|
||||
@ -25,4 +23,3 @@ services:
|
||||
ports:
|
||||
- 4444:4443
|
||||
command: ['notary-server', '-config=/fixtures/notary-config.json']
|
||||
|
||||
|
||||
@ -101,3 +101,19 @@ func TestTrustedCreateFromBadTrustServer(t *testing.T) {
|
||||
Err: "could not rotate trust to a new trusted root",
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateWithEmptySourceVolume(t *testing.T) {
|
||||
icmd.RunCmd(icmd.Command("docker", "create", "-v", ":/volume", fixtures.AlpineImage)).
|
||||
Assert(t, icmd.Expected{
|
||||
ExitCode: 125,
|
||||
Err: "empty section between colons",
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateWithEmptyVolumeSpec(t *testing.T) {
|
||||
icmd.RunCmd(icmd.Command("docker", "create", "-v", "", fixtures.AlpineImage)).
|
||||
Assert(t, icmd.Expected{
|
||||
ExitCode: 125,
|
||||
Err: "invalid empty volume spec",
|
||||
})
|
||||
}
|
||||
|
||||
@ -17,11 +17,11 @@ const (
|
||||
// AlpineImage is an image in the test registry
|
||||
AlpineImage = "registry:5000/alpine:frozen"
|
||||
// AlpineSha is the sha of the alpine image
|
||||
AlpineSha = "e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501"
|
||||
AlpineSha = "e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501" // #nosec G101 -- ignoring: Potential hardcoded credentials (gosec)
|
||||
// BusyboxImage is an image in the test registry
|
||||
BusyboxImage = "registry:5000/busybox:frozen"
|
||||
// BusyboxSha is the sha of the busybox image
|
||||
BusyboxSha = "030fcb92e1487b18c974784dcc110a93147c9fc402188370fbfd17efabffc6af"
|
||||
BusyboxSha = "030fcb92e1487b18c974784dcc110a93147c9fc402188370fbfd17efabffc6af" // #nosec G101 -- ignoring: Potential hardcoded credentials (gosec)
|
||||
)
|
||||
|
||||
// SetupConfigFile creates a config.json file for testing
|
||||
|
||||
3
e2e/testdata/Dockerfile.gencerts
vendored
3
e2e/testdata/Dockerfile.gencerts
vendored
@ -1,8 +1,9 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GO_VERSION=1.20.4
|
||||
ARG GO_VERSION=1.20.10
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine AS generated
|
||||
ENV GOTOOLCHAIN=local
|
||||
RUN go install github.com/dmcgowan/quicktls@master
|
||||
WORKDIR /tmp/gencerts/notary
|
||||
RUN --mount=type=bind,source=e2e/testdata/notary,target=/tmp/gencerts/notary,rw <<EOT
|
||||
|
||||
@ -8,7 +8,7 @@ docker-build - Build an image from a Dockerfile
|
||||
[**--add-host**[=*[]*]]
|
||||
[**--build-arg**[=*[]*]]
|
||||
[**--cache-from**[=*[]*]]
|
||||
[**--cpu-shares**[=*0*]]
|
||||
[**-c**|**--cpu-shares**[=*0*]]
|
||||
[**--cgroup-parent**[=*CGROUP-PARENT*]]
|
||||
[**--help**]
|
||||
[**--iidfile**[=*CIDFILE*]]
|
||||
@ -153,7 +153,7 @@ In Linux, default is **bridge**.
|
||||
Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you omit the unit, the system uses bytes.
|
||||
If you omit the size entirely, the system uses `64m`.
|
||||
|
||||
**--cpu-shares** *0*
|
||||
**-c**, **--cpu-shares** *0*
|
||||
CPU shares (relative weight).
|
||||
|
||||
By default, all containers get the same proportion of CPU cycles.
|
||||
@ -166,7 +166,7 @@ In Linux, default is **bridge**.
|
||||
You can change this proportion by adjusting the container's CPU share
|
||||
weighting relative to the weighting of all other running containers.
|
||||
|
||||
To modify the proportion from the default of 1024, use the **--cpu-shares**
|
||||
To modify the proportion from the default of 1024, use the **-c** or **--cpu-shares**
|
||||
flag to set the weighting to 2 or higher.
|
||||
|
||||
Container CPU share Flag
|
||||
|
||||
@ -10,7 +10,7 @@ docker-run - Create and run a new container from an image
|
||||
[**--annotation**[=*[]*]]
|
||||
[**--blkio-weight**[=*[BLKIO-WEIGHT]*]]
|
||||
[**--blkio-weight-device**[=*[]*]]
|
||||
[**--cpu-shares**[=*0*]]
|
||||
[**-c**|**--cpu-shares**[=*0*]]
|
||||
[**--cap-add**[=*[]*]]
|
||||
[**--cap-drop**[=*[]*]]
|
||||
[**--cgroupns**[=*[]*]]
|
||||
@ -137,14 +137,14 @@ option can be set multiple times.
|
||||
**--blkio-weight-device**=[]
|
||||
Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`).
|
||||
|
||||
**--cpu-shares**=*0*
|
||||
**-c**, **--cpu-shares**=*0*
|
||||
CPU shares (relative weight)
|
||||
|
||||
By default, all containers get the same proportion of CPU cycles. This proportion
|
||||
can be modified by changing the container's CPU share weighting relative
|
||||
to the weighting of all other running containers.
|
||||
|
||||
To modify the proportion from the default of 1024, use the **--cpu-shares**
|
||||
To modify the proportion from the default of 1024, use the **-c** or **--cpu-shares**
|
||||
flag to set the weighting to 2 or higher.
|
||||
|
||||
The proportion will only apply when CPU-intensive processes are running.
|
||||
|
||||
@ -7,7 +7,7 @@ go 1.16
|
||||
|
||||
//require (
|
||||
// github.com/docker/cli v0.0.0+incompatible
|
||||
// github.com/cpuguy83/go-md2man/v2 v2.0.1
|
||||
// github.com/cpuguy83/go-md2man/v2 v2.0.3
|
||||
// github.com/spf13/cobra v1.2.1
|
||||
// github.com/spf13/pflag v1.0.5
|
||||
//)
|
||||
|
||||
@ -13,9 +13,29 @@ file. See **config-json(5)** for documentation on using a configuration file.
|
||||
It is forbidden to redirect the standard input of a **docker attach** command while
|
||||
attaching to a TTY-enabled container (i.e., launched with `-i` and `-t`).
|
||||
|
||||
# Override the detach sequence
|
||||
# EXAMPLES
|
||||
|
||||
If you want, you can configure an override the Docker key sequence for detach.
|
||||
## Attaching to a container
|
||||
|
||||
In this example the top command is run inside a container from an ubuntu image,
|
||||
in detached mode, then attaches to it, and then terminates the container
|
||||
with `CTRL-c`:
|
||||
|
||||
$ docker run -d --name topdemo ubuntu:20.04 /usr/bin/top -b
|
||||
$ docker attach topdemo
|
||||
top - 00:07:01 up 4:54, 0 users, load average: 0.83, 0.91, 0.82
|
||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||
%Cpu(s): 2.3 us, 1.6 sy, 0.0 ni, 95.9 id, 0.0 wa, 0.1 hi, 0.1 si, 0.0 st
|
||||
MiB Mem : 15846.2 total, 5729.2 free, 2592.5 used, 7524.4 buff/cache
|
||||
MiB Swap: 16384.0 total, 16384.0 free, 0.0 used. 12097.3 avail Mem
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
1 root 20 0 5976 3256 2828 R 0.0 0.0 0:00.04 top
|
||||
^C
|
||||
|
||||
## Override the detach sequence
|
||||
|
||||
Use the **--detach-keys** option to override the Docker key sequence for detach.
|
||||
This is useful if the Docker default sequence conflicts with key sequence you
|
||||
use for other applications. There are two ways to define your own detach key
|
||||
sequence, as a per-container override or as a configuration property on your
|
||||
@ -37,22 +57,3 @@ These **a**, **ctrl-a**, **X**, or **ctrl-\\** values are all examples of valid
|
||||
sequences. To configure a different configuration default key sequence for all
|
||||
containers, see **docker(1)**.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Attaching to a container
|
||||
|
||||
In this example the top command is run inside a container from an ubuntu image,
|
||||
in detached mode, then attaches to it, and then terminates the container
|
||||
with `CTRL-c`:
|
||||
|
||||
$ docker run -d --name topdemo ubuntu:20.04 /usr/bin/top -b
|
||||
$ docker attach topdemo
|
||||
top - 00:07:01 up 4:54, 0 users, load average: 0.83, 0.91, 0.82
|
||||
Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
|
||||
%Cpu(s): 2.3 us, 1.6 sy, 0.0 ni, 95.9 id, 0.0 wa, 0.1 hi, 0.1 si, 0.0 st
|
||||
MiB Mem : 15846.2 total, 5729.2 free, 2592.5 used, 7524.4 buff/cache
|
||||
MiB Swap: 16384.0 total, 16384.0 free, 0.0 used. 12097.3 avail Mem
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
1 root 20 0 5976 3256 2828 R 0.0 0.0 0:00.04 top
|
||||
^C
|
||||
|
||||
@ -9,7 +9,7 @@ container is unpaused, and then run
|
||||
# CAPABILITIES
|
||||
|
||||
`privileged` gives the process extended
|
||||
[Linux capabilities](http://man7.org/linux/man-pages/man7/capabilities.7.html)
|
||||
[Linux capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html)
|
||||
when running in a container.
|
||||
|
||||
Without this flag, the process run by `docker exec` in a running container has
|
||||
|
||||
@ -193,7 +193,7 @@ output:
|
||||
80/tcp -> 80
|
||||
|
||||
You can get more information about how to write a Go template from:
|
||||
https://golang.org/pkg/text/template/.
|
||||
https://pkg.go.dev/text/template.
|
||||
|
||||
## Getting size information on a container
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727
|
||||
The `network inspect` command shows the containers, by id, in its
|
||||
results. You can specify an alternate format to execute a given
|
||||
template for each result. Go's
|
||||
[text/template](http://golang.org/pkg/text/template/) package
|
||||
[text/template](https://pkg.go.dev/text/template) package
|
||||
describes all the details of the format.
|
||||
|
||||
```console
|
||||
|
||||
@ -85,7 +85,7 @@ details of the format.
|
||||
Type=container Status=destroy ID=2ee349dac409e97974ce8d01b70d250b85e0ba8189299c126a87812311951e26
|
||||
|
||||
If a format is set to `{{json .}}`, the events are streamed as valid JSON
|
||||
Lines. For information about JSON Lines, please refer to http://jsonlines.org/ .
|
||||
Lines. For information about JSON Lines, please refer to https://jsonlines.org .
|
||||
|
||||
# docker events --format '{{json .}}'
|
||||
{"status":"create","id":"196016a57679bf42424484918746a9474cd905dd993c4d0f4..
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Returns information about one or more volumes. By default, this command renders
|
||||
all results in a JSON array. You can specify an alternate format to execute a
|
||||
given template is executed for each result. Go's https://golang.org/pkg/text/template/
|
||||
given template is executed for each result. Go's https://pkg.go.dev/text/template
|
||||
package describes all the details of the format.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
set -eu
|
||||
|
||||
: "${MD2MAN_VERSION=v2.0.1}"
|
||||
: "${MD2MAN_VERSION=v2.0.3}"
|
||||
|
||||
export GO111MODULE=auto
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
set -eu
|
||||
|
||||
: "${CLI_DOCS_TOOL_VERSION=v0.5.1}"
|
||||
: "${CLI_DOCS_TOOL_VERSION=v0.6.0}"
|
||||
|
||||
export GO111MODULE=auto
|
||||
|
||||
|
||||
@ -26,13 +26,13 @@ setup() {
|
||||
export TEST_CONNHELPER_SSH_ID_RSA_PUB
|
||||
file="${file}:./e2e/compose-env.connhelper-ssh.yaml"
|
||||
fi
|
||||
COMPOSE_PROJECT_NAME=$project COMPOSE_FILE=$file docker-compose up --build -d >&2
|
||||
COMPOSE_PROJECT_NAME=$project COMPOSE_FILE=$file docker compose up --build -d >&2
|
||||
|
||||
local network="${project}_default"
|
||||
# TODO: only run if inside a container
|
||||
docker network connect "$network" "$(hostname)"
|
||||
|
||||
engine_ip="$(container_ip "${project}_engine_1" "$network")"
|
||||
engine_ip="$(container_ip "${project}-engine-1" "$network")"
|
||||
engine_host="tcp://$engine_ip:2375"
|
||||
if [ "${TEST_CONNHELPER:-}" = "ssh" ];then
|
||||
engine_host="ssh://penguin@${engine_ip}"
|
||||
@ -54,7 +54,7 @@ cleanup() {
|
||||
local project=$1
|
||||
local network="${project}_default"
|
||||
docker network disconnect "$network" "$(hostname)"
|
||||
COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker-compose down -v --rmi local >&2
|
||||
COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker compose down -v --rmi local >&2
|
||||
}
|
||||
|
||||
runtests() {
|
||||
|
||||
@ -18,12 +18,12 @@ init() {
|
||||
cat > go.mod <<EOL
|
||||
module github.com/docker/cli
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
EOL
|
||||
}
|
||||
|
||||
update() {
|
||||
(set -x ; go mod tidy -compat=1.18 -modfile=vendor.mod; go mod vendor -modfile=vendor.mod)
|
||||
(set -x ; go mod tidy -compat=1.19 -modfile=vendor.mod; go mod vendor -modfile=vendor.mod)
|
||||
}
|
||||
|
||||
validate() {
|
||||
|
||||
28
vendor.mod
28
vendor.mod
@ -4,13 +4,13 @@ module github.com/docker/cli
|
||||
// There is no 'go.mod' file, as that would imply opting in for all the rules
|
||||
// around SemVer, which this repo cannot abide by as it uses CalVer.
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/containerd/containerd v1.6.21
|
||||
github.com/creack/pty v1.1.18
|
||||
github.com/docker/distribution v2.8.2+incompatible
|
||||
github.com/docker/docker v24.0.1+incompatible
|
||||
github.com/docker/docker v24.0.6+incompatible
|
||||
github.com/docker/docker-credential-helpers v0.7.0
|
||||
github.com/docker/go-connections v0.4.0
|
||||
github.com/docker/go-units v0.5.0
|
||||
@ -22,27 +22,27 @@ require (
|
||||
github.com/mattn/go-runewidth v0.0.14
|
||||
github.com/mitchellh/mapstructure v1.3.2
|
||||
github.com/moby/buildkit v0.11.6
|
||||
github.com/moby/patternmatcher v0.5.0
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7
|
||||
github.com/moby/patternmatcher v0.6.0
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b
|
||||
github.com/moby/sys/sequential v0.5.0
|
||||
github.com/moby/sys/signal v0.7.0
|
||||
github.com/moby/term v0.5.0
|
||||
github.com/morikuni/aec v1.0.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
|
||||
github.com/opencontainers/image-spec v1.1.0-rc3
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a
|
||||
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d
|
||||
github.com/xeipuuv/gojsonschema v1.2.0
|
||||
golang.org/x/sync v0.1.0
|
||||
golang.org/x/sys v0.6.0
|
||||
golang.org/x/term v0.6.0
|
||||
golang.org/x/text v0.8.0
|
||||
golang.org/x/sync v0.3.0
|
||||
golang.org/x/sys v0.13.0
|
||||
golang.org/x/term v0.13.0
|
||||
golang.org/x/text v0.13.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gotest.tools/v3 v3.4.0
|
||||
gotest.tools/v3 v3.5.0
|
||||
)
|
||||
|
||||
require (
|
||||
@ -57,7 +57,7 @@ require (
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/klauspost/compress v1.16.3 // indirect
|
||||
github.com/klauspost/compress v1.17.2 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/miekg/pkcs11 v1.1.1 // indirect
|
||||
github.com/moby/sys/symlink v0.2.0 // indirect
|
||||
@ -70,8 +70,8 @@ require (
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
go.etcd.io/etcd/raft/v3 v3.5.6 // indirect
|
||||
golang.org/x/crypto v0.2.0 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220706185917-7780775163c4 // indirect
|
||||
google.golang.org/grpc v1.50.1 // indirect
|
||||
|
||||
53
vendor.sum
53
vendor.sum
@ -96,8 +96,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xb
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
|
||||
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v24.0.1+incompatible h1:NxN81beIxDlUaVt46iUQrYHD9/W3u9EGl52r86O/IGw=
|
||||
github.com/docker/docker v24.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v24.0.6+incompatible h1:hceabKCtUgDqPu+qm0NgsaXf28Ljf4/pWFL7xjWWDgE=
|
||||
github.com/docker/docker v24.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A=
|
||||
github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0=
|
||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
||||
@ -243,8 +243,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
|
||||
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
|
||||
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
@ -271,10 +271,10 @@ github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYG
|
||||
github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/moby/buildkit v0.11.6 h1:VYNdoKk5TVxN7k4RvZgdeM4GOyRvIi4Z8MXOY7xvyUs=
|
||||
github.com/moby/buildkit v0.11.6/go.mod h1:GCqKfHhz+pddzfgaR7WmHVEE3nKKZMMDPpK8mh3ZLv4=
|
||||
github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo=
|
||||
github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7 h1:h6NclNly6/B9N4IdM5pcBaq/LkNLuaCmE7B44Vj+pb0=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230406225228-75e92ce14ff7/go.mod h1:P/ha3F7UZMmuUvqrHw9cZK/BjktSngQIgRPiairNHTc=
|
||||
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
|
||||
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b h1:w07xyBXYTrihwBqCkuXPLqcQ1a2guqXlRIocU+e9K7A=
|
||||
github.com/moby/swarmkit/v2 v2.0.0-20230531205928-01bb7a41396b/go.mod h1:Z5i5At5g0zU+ZBWb/95yVwDeNQX8BZmei9ZoYvoVD7g=
|
||||
github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc=
|
||||
github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo=
|
||||
github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI=
|
||||
@ -301,8 +301,8 @@ github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
|
||||
github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk=
|
||||
github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50=
|
||||
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
|
||||
@ -357,8 +357,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spf13/cast v0.0.0-20150508191742-4d07383ffe94 h1:JmfC365KywYwHB946TTiQWEb8kqPY+pybPLoGE9GgVk=
|
||||
github.com/spf13/cast v0.0.0-20150508191742-4d07383ffe94/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
|
||||
github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
@ -416,8 +416,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
|
||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE=
|
||||
golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@ -482,8 +482,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@ -501,8 +501,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -553,13 +553,13 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -568,8 +568,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -618,7 +618,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -740,8 +739,8 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
|
||||
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
|
||||
gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY=
|
||||
gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
50
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
50
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
@ -5068,7 +5068,7 @@ definitions:
|
||||
Go runtime (`GOOS`).
|
||||
|
||||
Currently returned values are "linux" and "windows". A full list of
|
||||
possible values can be found in the [Go documentation](https://golang.org/doc/install/source#environment).
|
||||
possible values can be found in the [Go documentation](https://go.dev/doc/install/source#environment).
|
||||
type: "string"
|
||||
example: "linux"
|
||||
Architecture:
|
||||
@ -5076,7 +5076,7 @@ definitions:
|
||||
Hardware architecture of the host, as returned by the Go runtime
|
||||
(`GOARCH`).
|
||||
|
||||
A full list of possible values can be found in the [Go documentation](https://golang.org/doc/install/source#environment).
|
||||
A full list of possible values can be found in the [Go documentation](https://go.dev/doc/install/source#environment).
|
||||
type: "string"
|
||||
example: "x86_64"
|
||||
NCPU:
|
||||
@ -5162,42 +5162,8 @@ definitions:
|
||||
ServerVersion:
|
||||
description: |
|
||||
Version string of the daemon.
|
||||
|
||||
> **Note**: the [standalone Swarm API](https://docs.docker.com/swarm/swarm-api/)
|
||||
> returns the Swarm version instead of the daemon version, for example
|
||||
> `swarm/1.2.8`.
|
||||
type: "string"
|
||||
example: "17.06.0-ce"
|
||||
ClusterStore:
|
||||
description: |
|
||||
URL of the distributed storage backend.
|
||||
|
||||
|
||||
The storage backend is used for multihost networking (to store
|
||||
network and endpoint information) and by the node discovery mechanism.
|
||||
|
||||
<p><br /></p>
|
||||
|
||||
> **Deprecated**: This field is only propagated when using standalone Swarm
|
||||
> mode, and overlay networking using an external k/v store. Overlay
|
||||
> networks with Swarm mode enabled use the built-in raft store, and
|
||||
> this field will be empty.
|
||||
type: "string"
|
||||
example: "consul://consul.corp.example.com:8600/some/path"
|
||||
ClusterAdvertise:
|
||||
description: |
|
||||
The network endpoint that the Engine advertises for the purpose of
|
||||
node discovery. ClusterAdvertise is a `host:port` combination on which
|
||||
the daemon is reachable by other hosts.
|
||||
|
||||
<p><br /></p>
|
||||
|
||||
> **Deprecated**: This field is only propagated when using standalone Swarm
|
||||
> mode, and overlay networking using an external k/v store. Overlay
|
||||
> networks with Swarm mode enabled use the built-in raft store, and
|
||||
> this field will be empty.
|
||||
type: "string"
|
||||
example: "node5.corp.example.com:8000"
|
||||
example: "24.0.2"
|
||||
Runtimes:
|
||||
description: |
|
||||
List of [OCI compliant](https://github.com/opencontainers/runtime-spec)
|
||||
@ -9930,7 +9896,9 @@ paths:
|
||||
Id: "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30"
|
||||
Warning: ""
|
||||
403:
|
||||
description: "operation not supported for pre-defined networks"
|
||||
description: |
|
||||
Forbidden operation. This happens when trying to create a network named after a pre-defined network,
|
||||
or when trying to create an overlay network on a daemon which is not part of a Swarm cluster.
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
404:
|
||||
@ -10393,6 +10361,12 @@ paths:
|
||||
default if omitted.
|
||||
required: true
|
||||
type: "string"
|
||||
- name: "force"
|
||||
in: "query"
|
||||
description: |
|
||||
Force disable a plugin even if still in use.
|
||||
required: false
|
||||
type: "boolean"
|
||||
tags: ["Plugin"]
|
||||
/plugins/{name}/upgrade:
|
||||
post:
|
||||
|
||||
4
vendor/github.com/docker/docker/api/types/configs.go
generated
vendored
4
vendor/github.com/docker/docker/api/types/configs.go
generated
vendored
@ -3,7 +3,7 @@ package types // import "github.com/docker/docker/api/types"
|
||||
import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
// configs holds structs used for internal communication between the
|
||||
@ -16,7 +16,7 @@ type ContainerCreateConfig struct {
|
||||
Config *container.Config
|
||||
HostConfig *container.HostConfig
|
||||
NetworkingConfig *network.NetworkingConfig
|
||||
Platform *specs.Platform
|
||||
Platform *ocispec.Platform
|
||||
AdjustCPUShares bool
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user