mirror of https://github.com/docker/cli.git
vendor: github.com/docker/docker cdb3f9fb8dca (v25.0.0-dev)
full diff: d3afa80b96...cdb3f9fb8d
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
3441151e07
commit
46d0ba20f1
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/formatter"
|
"github.com/docker/cli/cli/command/formatter"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/volume"
|
"github.com/docker/docker/api/types/volume"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -33,7 +34,7 @@ func ImageNames(dockerCli command.Cli) ValidArgsFn {
|
||||||
// Set DOCKER_COMPLETION_SHOW_CONTAINER_IDS=yes to also complete IDs.
|
// Set DOCKER_COMPLETION_SHOW_CONTAINER_IDS=yes to also complete IDs.
|
||||||
func ContainerNames(dockerCli command.Cli, all bool, filters ...func(types.Container) bool) ValidArgsFn {
|
func ContainerNames(dockerCli command.Cli, all bool, filters ...func(types.Container) bool) ValidArgsFn {
|
||||||
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
list, err := dockerCli.Client().ContainerList(cmd.Context(), types.ContainerListOptions{
|
list, err := dockerCli.Client().ContainerList(cmd.Context(), container.ListOptions{
|
||||||
All: all,
|
All: all,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -91,7 +91,7 @@ func runAttach(dockerCli command.Cli, opts *attachOptions) error {
|
||||||
detachKeys = opts.detachKeys
|
detachKeys = opts.detachKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
options := types.ContainerAttachOptions{
|
options := container.AttachOptions{
|
||||||
Stream: true,
|
Stream: true,
|
||||||
Stdin: !opts.noStdin && c.Config.OpenStdin,
|
Stdin: !opts.noStdin && c.Config.OpenStdin,
|
||||||
Stdout: true,
|
Stdout: true,
|
||||||
|
|
|
@ -22,22 +22,22 @@ type fakeClient struct {
|
||||||
networkingConfig *network.NetworkingConfig,
|
networkingConfig *network.NetworkingConfig,
|
||||||
platform *specs.Platform,
|
platform *specs.Platform,
|
||||||
containerName string) (container.CreateResponse, error)
|
containerName string) (container.CreateResponse, error)
|
||||||
containerStartFunc func(container string, options types.ContainerStartOptions) error
|
containerStartFunc func(container string, options container.StartOptions) error
|
||||||
imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
|
imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
|
||||||
infoFunc func() (system.Info, error)
|
infoFunc func() (system.Info, error)
|
||||||
containerStatPathFunc func(container, path string) (types.ContainerPathStat, error)
|
containerStatPathFunc func(container, path string) (types.ContainerPathStat, error)
|
||||||
containerCopyFromFunc func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
|
containerCopyFromFunc func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
|
||||||
logFunc func(string, types.ContainerLogsOptions) (io.ReadCloser, error)
|
logFunc func(string, container.LogsOptions) (io.ReadCloser, error)
|
||||||
waitFunc func(string) (<-chan container.WaitResponse, <-chan error)
|
waitFunc func(string) (<-chan container.WaitResponse, <-chan error)
|
||||||
containerListFunc func(types.ContainerListOptions) ([]types.Container, error)
|
containerListFunc func(container.ListOptions) ([]types.Container, error)
|
||||||
containerExportFunc func(string) (io.ReadCloser, error)
|
containerExportFunc func(string) (io.ReadCloser, error)
|
||||||
containerExecResizeFunc func(id string, options types.ResizeOptions) error
|
containerExecResizeFunc func(id string, options container.ResizeOptions) error
|
||||||
containerRemoveFunc func(ctx context.Context, container string, options types.ContainerRemoveOptions) error
|
containerRemoveFunc func(ctx context.Context, container string, options container.RemoveOptions) error
|
||||||
containerKillFunc func(ctx context.Context, container, signal string) error
|
containerKillFunc func(ctx context.Context, container, signal string) error
|
||||||
Version string
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) ContainerList(_ context.Context, options types.ContainerListOptions) ([]types.Container, error) {
|
func (f *fakeClient) ContainerList(_ context.Context, options container.ListOptions) ([]types.Container, error) {
|
||||||
if f.containerListFunc != nil {
|
if f.containerListFunc != nil {
|
||||||
return f.containerListFunc(options)
|
return f.containerListFunc(options)
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ func (f *fakeClient) ContainerCreate(
|
||||||
return container.CreateResponse{}, nil
|
return container.CreateResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error {
|
func (f *fakeClient) ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error {
|
||||||
if f.containerRemoveFunc != nil {
|
if f.containerRemoveFunc != nil {
|
||||||
return f.containerRemoveFunc(ctx, container, options)
|
return f.containerRemoveFunc(ctx, container, options)
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ func (f *fakeClient) CopyFromContainer(_ context.Context, container, srcPath str
|
||||||
return nil, types.ContainerPathStat{}, nil
|
return nil, types.ContainerPathStat{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) ContainerLogs(_ context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
func (f *fakeClient) ContainerLogs(_ context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) {
|
||||||
if f.logFunc != nil {
|
if f.logFunc != nil {
|
||||||
return f.logFunc(container, options)
|
return f.logFunc(container, options)
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ func (f *fakeClient) ContainerWait(_ context.Context, container string, _ contai
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) ContainerStart(_ context.Context, container string, options types.ContainerStartOptions) error {
|
func (f *fakeClient) ContainerStart(_ context.Context, container string, options container.StartOptions) error {
|
||||||
if f.containerStartFunc != nil {
|
if f.containerStartFunc != nil {
|
||||||
return f.containerStartFunc(container, options)
|
return f.containerStartFunc(container, options)
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ func (f *fakeClient) ContainerExport(_ context.Context, container string) (io.Re
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) ContainerExecResize(_ context.Context, id string, options types.ResizeOptions) error {
|
func (f *fakeClient) ContainerExecResize(_ context.Context, id string, options container.ResizeOptions) error {
|
||||||
if f.containerExecResizeFunc != nil {
|
if f.containerExecResizeFunc != nil {
|
||||||
return f.containerExecResizeFunc(id, options)
|
return f.containerExecResizeFunc(id, options)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/completion"
|
"github.com/docker/cli/cli/command/completion"
|
||||||
"github.com/docker/cli/opts"
|
"github.com/docker/cli/opts"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -59,18 +59,13 @@ func NewCommitCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func runCommit(dockerCli command.Cli, options *commitOptions) error {
|
func runCommit(dockerCli command.Cli, options *commitOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
name := options.container
|
response, err := dockerCli.Client().ContainerCommit(ctx, options.container, container.CommitOptions{
|
||||||
reference := options.reference
|
Reference: options.reference,
|
||||||
|
|
||||||
commitOptions := types.ContainerCommitOptions{
|
|
||||||
Reference: reference,
|
|
||||||
Comment: options.comment,
|
Comment: options.comment,
|
||||||
Author: options.author,
|
Author: options.author,
|
||||||
Changes: options.changes.GetAll(),
|
Changes: options.changes.GetAll(),
|
||||||
Pause: options.pause,
|
Pause: options.pause,
|
||||||
}
|
})
|
||||||
|
|
||||||
response, err := dockerCli.Client().ContainerCommit(ctx, name, commitOptions)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
flagsHelper "github.com/docker/cli/cli/flags"
|
flagsHelper "github.com/docker/cli/cli/flags"
|
||||||
"github.com/docker/cli/opts"
|
"github.com/docker/cli/opts"
|
||||||
"github.com/docker/cli/templates"
|
"github.com/docker/cli/templates"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -68,8 +68,8 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
return &cmd
|
return &cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) {
|
func buildContainerListOptions(opts *psOptions) (*container.ListOptions, error) {
|
||||||
options := &types.ContainerListOptions{
|
options := &container.ListOptions{
|
||||||
All: opts.all,
|
All: opts.all,
|
||||||
Limit: opts.last,
|
Limit: opts.last,
|
||||||
Size: opts.size,
|
Size: opts.size,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
|
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
|
||||||
"github.com/docker/cli/opts"
|
"github.com/docker/cli/opts"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
"gotest.tools/v3/golden"
|
"gotest.tools/v3/golden"
|
||||||
|
@ -129,7 +130,7 @@ func TestContainerListErrors(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
args []string
|
args []string
|
||||||
flags map[string]string
|
flags map[string]string
|
||||||
containerListFunc func(types.ContainerListOptions) ([]types.Container, error)
|
containerListFunc func(container.ListOptions) ([]types.Container, error)
|
||||||
expectedError string
|
expectedError string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
@ -145,7 +146,7 @@ func TestContainerListErrors(t *testing.T) {
|
||||||
expectedError: `wrong number of args for join`,
|
expectedError: `wrong number of args for join`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return nil, fmt.Errorf("error listing containers")
|
return nil, fmt.Errorf("error listing containers")
|
||||||
},
|
},
|
||||||
expectedError: "error listing containers",
|
expectedError: "error listing containers",
|
||||||
|
@ -168,7 +169,7 @@ func TestContainerListErrors(t *testing.T) {
|
||||||
|
|
||||||
func TestContainerListWithoutFormat(t *testing.T) {
|
func TestContainerListWithoutFormat(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
*Container("c1"),
|
*Container("c1"),
|
||||||
*Container("c2", WithName("foo")),
|
*Container("c2", WithName("foo")),
|
||||||
|
@ -185,7 +186,7 @@ func TestContainerListWithoutFormat(t *testing.T) {
|
||||||
|
|
||||||
func TestContainerListNoTrunc(t *testing.T) {
|
func TestContainerListNoTrunc(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
*Container("c1"),
|
*Container("c1"),
|
||||||
*Container("c2", WithName("foo/bar")),
|
*Container("c2", WithName("foo/bar")),
|
||||||
|
@ -201,7 +202,7 @@ func TestContainerListNoTrunc(t *testing.T) {
|
||||||
// Test for GitHub issue docker/docker#21772
|
// Test for GitHub issue docker/docker#21772
|
||||||
func TestContainerListNamesMultipleTime(t *testing.T) {
|
func TestContainerListNamesMultipleTime(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
*Container("c1"),
|
*Container("c1"),
|
||||||
*Container("c2", WithName("foo/bar")),
|
*Container("c2", WithName("foo/bar")),
|
||||||
|
@ -217,7 +218,7 @@ func TestContainerListNamesMultipleTime(t *testing.T) {
|
||||||
// Test for GitHub issue docker/docker#30291
|
// Test for GitHub issue docker/docker#30291
|
||||||
func TestContainerListFormatTemplateWithArg(t *testing.T) {
|
func TestContainerListFormatTemplateWithArg(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
*Container("c1", WithLabel("some.label", "value")),
|
*Container("c1", WithLabel("some.label", "value")),
|
||||||
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")),
|
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")),
|
||||||
|
@ -268,7 +269,7 @@ func TestContainerListFormatSizeSetsOption(t *testing.T) {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(tc.doc, func(t *testing.T) {
|
t.Run(tc.doc, func(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(options types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(options container.ListOptions) ([]types.Container, error) {
|
||||||
assert.Check(t, is.Equal(options.Size, tc.sizeExpected))
|
assert.Check(t, is.Equal(options.Size, tc.sizeExpected))
|
||||||
return []types.Container{}, nil
|
return []types.Container{}, nil
|
||||||
},
|
},
|
||||||
|
@ -285,7 +286,7 @@ func TestContainerListFormatSizeSetsOption(t *testing.T) {
|
||||||
|
|
||||||
func TestContainerListWithConfigFormat(t *testing.T) {
|
func TestContainerListWithConfigFormat(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
*Container("c1", WithLabel("some.label", "value"), WithSize(10700000)),
|
*Container("c1", WithLabel("some.label", "value"), WithSize(10700000)),
|
||||||
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar"), WithSize(3200000)),
|
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar"), WithSize(3200000)),
|
||||||
|
@ -302,7 +303,7 @@ func TestContainerListWithConfigFormat(t *testing.T) {
|
||||||
|
|
||||||
func TestContainerListWithFormat(t *testing.T) {
|
func TestContainerListWithFormat(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
|
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
|
||||||
return []types.Container{
|
return []types.Container{
|
||||||
*Container("c1", WithLabel("some.label", "value")),
|
*Container("c1", WithLabel("some.label", "value")),
|
||||||
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")),
|
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")),
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/completion"
|
"github.com/docker/cli/cli/command/completion"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -60,7 +60,7 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
options := types.ContainerLogsOptions{
|
responseBody, err := dockerCli.Client().ContainerLogs(ctx, c.ID, container.LogsOptions{
|
||||||
ShowStdout: true,
|
ShowStdout: true,
|
||||||
ShowStderr: true,
|
ShowStderr: true,
|
||||||
Since: opts.since,
|
Since: opts.since,
|
||||||
|
@ -69,8 +69,7 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
Follow: opts.follow,
|
Follow: opts.follow,
|
||||||
Tail: opts.tail,
|
Tail: opts.tail,
|
||||||
Details: opts.details,
|
Details: opts.details,
|
||||||
}
|
})
|
||||||
responseBody, err := dockerCli.Client().ContainerLogs(ctx, c.ID, options)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logFn = func(expectedOut string) func(string, types.ContainerLogsOptions) (io.ReadCloser, error) {
|
var logFn = func(expectedOut string) func(string, container.LogsOptions) (io.ReadCloser, error) {
|
||||||
return func(container string, opts types.ContainerLogsOptions) (io.ReadCloser, error) {
|
return func(container string, opts container.LogsOptions) (io.ReadCloser, error) {
|
||||||
return io.NopCloser(strings.NewReader(expectedOut)), nil
|
return io.NopCloser(strings.NewReader(expectedOut)), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/completion"
|
"github.com/docker/cli/cli/command/completion"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -52,18 +52,16 @@ func runRm(dockerCli command.Cli, opts *rmOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
options := types.ContainerRemoveOptions{
|
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, ctrID string) error {
|
||||||
|
ctrID = strings.Trim(ctrID, "/")
|
||||||
|
if ctrID == "" {
|
||||||
|
return errors.New("Container name cannot be empty")
|
||||||
|
}
|
||||||
|
return dockerCli.Client().ContainerRemove(ctx, ctrID, container.RemoveOptions{
|
||||||
RemoveVolumes: opts.rmVolumes,
|
RemoveVolumes: opts.rmVolumes,
|
||||||
RemoveLinks: opts.rmLink,
|
RemoveLinks: opts.rmLink,
|
||||||
Force: opts.force,
|
Force: opts.force,
|
||||||
}
|
})
|
||||||
|
|
||||||
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error {
|
|
||||||
container = strings.Trim(container, "/")
|
|
||||||
if container == "" {
|
|
||||||
return errors.New("Container name cannot be empty")
|
|
||||||
}
|
|
||||||
return dockerCli.Client().ContainerRemove(ctx, container, options)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, name := range opts.containers {
|
for _, name := range opts.containers {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
@ -29,7 +29,7 @@ func TestRemoveForce(t *testing.T) {
|
||||||
mutex := new(sync.Mutex)
|
mutex := new(sync.Mutex)
|
||||||
|
|
||||||
cli := test.NewFakeCli(&fakeClient{
|
cli := test.NewFakeCli(&fakeClient{
|
||||||
containerRemoveFunc: func(ctx context.Context, container string, options types.ContainerRemoveOptions) error {
|
containerRemoveFunc: func(ctx context.Context, container string, options container.RemoveOptions) error {
|
||||||
// containerRemoveFunc is called in parallel for each container
|
// containerRemoveFunc is called in parallel for each container
|
||||||
// by the remove command so append must be synchronized.
|
// by the remove command so append must be synchronized.
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/completion"
|
"github.com/docker/cli/cli/command/completion"
|
||||||
"github.com/docker/cli/opts"
|
"github.com/docker/cli/opts"
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/moby/sys/signal"
|
"github.com/moby/sys/signal"
|
||||||
"github.com/moby/term"
|
"github.com/moby/term"
|
||||||
|
@ -174,7 +173,7 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio
|
||||||
detachKeys = opts.detachKeys
|
detachKeys = opts.detachKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
closeFn, err := attachContainer(ctx, dockerCli, containerID, &errCh, config, types.ContainerAttachOptions{
|
closeFn, err := attachContainer(ctx, dockerCli, containerID, &errCh, config, container.AttachOptions{
|
||||||
Stream: true,
|
Stream: true,
|
||||||
Stdin: config.AttachStdin,
|
Stdin: config.AttachStdin,
|
||||||
Stdout: config.AttachStdout,
|
Stdout: config.AttachStdout,
|
||||||
|
@ -190,7 +189,7 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio
|
||||||
statusChan := waitExitOrRemoved(ctx, dockerCli.Client(), containerID, copts.autoRemove)
|
statusChan := waitExitOrRemoved(ctx, dockerCli.Client(), containerID, copts.autoRemove)
|
||||||
|
|
||||||
// start the container
|
// start the container
|
||||||
if err := client.ContainerStart(ctx, containerID, types.ContainerStartOptions{}); err != nil {
|
if err := client.ContainerStart(ctx, containerID, container.StartOptions{}); err != nil {
|
||||||
// If we have hijackedIOStreamer, we should notify
|
// If we have hijackedIOStreamer, we should notify
|
||||||
// hijackedIOStreamer we are going to exit and wait
|
// hijackedIOStreamer we are going to exit and wait
|
||||||
// to avoid the terminal are not restored.
|
// to avoid the terminal are not restored.
|
||||||
|
@ -239,7 +238,7 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func attachContainer(ctx context.Context, dockerCli command.Cli, containerID string, errCh *chan error, config *container.Config, options types.ContainerAttachOptions) (func(), error) {
|
func attachContainer(ctx context.Context, dockerCli command.Cli, containerID string, errCh *chan error, config *container.Config, options container.AttachOptions) (func(), error) {
|
||||||
resp, errAttach := dockerCli.Client().ContainerAttach(ctx, containerID, options)
|
resp, errAttach := dockerCli.Client().ContainerAttach(ctx, containerID, options)
|
||||||
if errAttach != nil {
|
if errAttach != nil {
|
||||||
return nil, errAttach
|
return nil, errAttach
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/completion"
|
"github.com/docker/cli/cli/command/completion"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/moby/sys/signal"
|
"github.com/moby/sys/signal"
|
||||||
"github.com/moby/term"
|
"github.com/moby/term"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -83,8 +84,8 @@ func RunStart(dockerCli command.Cli, opts *StartOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Attach to the container.
|
// 2. Attach to the container.
|
||||||
container := opts.Containers[0]
|
ctr := opts.Containers[0]
|
||||||
c, err := dockerCli.Client().ContainerInspect(ctx, container)
|
c, err := dockerCli.Client().ContainerInspect(ctx, ctr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,7 @@ func RunStart(dockerCli command.Cli, opts *StartOptions) error {
|
||||||
detachKeys = opts.DetachKeys
|
detachKeys = opts.DetachKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
options := types.ContainerAttachOptions{
|
options := container.AttachOptions{
|
||||||
Stream: true,
|
Stream: true,
|
||||||
Stdin: opts.OpenStdin && c.Config.OpenStdin,
|
Stdin: opts.OpenStdin && c.Config.OpenStdin,
|
||||||
Stdout: true,
|
Stdout: true,
|
||||||
|
@ -148,7 +149,7 @@ func RunStart(dockerCli command.Cli, opts *StartOptions) error {
|
||||||
statusChan := waitExitOrRemoved(ctx, dockerCli.Client(), c.ID, c.HostConfig.AutoRemove)
|
statusChan := waitExitOrRemoved(ctx, dockerCli.Client(), c.ID, c.HostConfig.AutoRemove)
|
||||||
|
|
||||||
// 4. Start the container.
|
// 4. Start the container.
|
||||||
err = dockerCli.Client().ContainerStart(ctx, c.ID, types.ContainerStartOptions{
|
err = dockerCli.Client().ContainerStart(ctx, c.ID, container.StartOptions{
|
||||||
CheckpointID: opts.Checkpoint,
|
CheckpointID: opts.Checkpoint,
|
||||||
CheckpointDir: opts.CheckpointDir,
|
CheckpointDir: opts.CheckpointDir,
|
||||||
})
|
})
|
||||||
|
@ -183,12 +184,11 @@ func RunStart(dockerCli command.Cli, opts *StartOptions) error {
|
||||||
if len(opts.Containers) > 1 {
|
if len(opts.Containers) > 1 {
|
||||||
return errors.New("you cannot restore multiple containers at once")
|
return errors.New("you cannot restore multiple containers at once")
|
||||||
}
|
}
|
||||||
container := opts.Containers[0]
|
ctr := opts.Containers[0]
|
||||||
startOptions := types.ContainerStartOptions{
|
return dockerCli.Client().ContainerStart(ctx, ctr, container.StartOptions{
|
||||||
CheckpointID: opts.Checkpoint,
|
CheckpointID: opts.Checkpoint,
|
||||||
CheckpointDir: opts.CheckpointDir,
|
CheckpointDir: opts.CheckpointDir,
|
||||||
}
|
})
|
||||||
return dockerCli.Client().ContainerStart(ctx, container, startOptions)
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We're not going to attach to anything.
|
// We're not going to attach to anything.
|
||||||
|
@ -201,13 +201,13 @@ func RunStart(dockerCli command.Cli, opts *StartOptions) error {
|
||||||
|
|
||||||
func startContainersWithoutAttachments(ctx context.Context, dockerCli command.Cli, containers []string) error {
|
func startContainersWithoutAttachments(ctx context.Context, dockerCli command.Cli, containers []string) error {
|
||||||
var failedContainers []string
|
var failedContainers []string
|
||||||
for _, container := range containers {
|
for _, ctr := range containers {
|
||||||
if err := dockerCli.Client().ContainerStart(ctx, container, types.ContainerStartOptions{}); err != nil {
|
if err := dockerCli.Client().ContainerStart(ctx, ctr, container.StartOptions{}); err != nil {
|
||||||
fmt.Fprintln(dockerCli.Err(), err)
|
fmt.Fprintln(dockerCli.Err(), err)
|
||||||
failedContainers = append(failedContainers, container)
|
failedContainers = append(failedContainers, ctr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Fprintln(dockerCli.Out(), container)
|
fmt.Fprintln(dockerCli.Out(), ctr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(failedContainers) > 0 {
|
if len(failedContainers) > 0 {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/docker/cli/cli/command/formatter"
|
"github.com/docker/cli/cli/command/formatter"
|
||||||
flagsHelper "github.com/docker/cli/cli/flags"
|
flagsHelper "github.com/docker/cli/cli/flags"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/events"
|
"github.com/docker/docker/api/types/events"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -110,15 +111,15 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
// getContainerList simulates creation event for all previously existing
|
// getContainerList simulates creation event for all previously existing
|
||||||
// containers (only used when calling `docker stats` without arguments).
|
// containers (only used when calling `docker stats` without arguments).
|
||||||
getContainerList := func() {
|
getContainerList := func() {
|
||||||
options := types.ContainerListOptions{
|
options := container.ListOptions{
|
||||||
All: opts.all,
|
All: opts.all,
|
||||||
}
|
}
|
||||||
cs, err := dockerCli.Client().ContainerList(ctx, options)
|
cs, err := dockerCli.Client().ContainerList(ctx, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
closeChan <- err
|
closeChan <- err
|
||||||
}
|
}
|
||||||
for _, container := range cs {
|
for _, ctr := range cs {
|
||||||
s := NewStats(container.ID[:12])
|
s := NewStats(ctr.ID[:12])
|
||||||
if cStats.add(s) {
|
if cStats.add(s) {
|
||||||
waitFirst.Add(1)
|
waitFirst.Add(1)
|
||||||
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
|
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
|
||||||
|
@ -135,7 +136,7 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
eh := command.InitEventHandler()
|
eh := command.InitEventHandler()
|
||||||
eh.Handle(events.ActionCreate, func(e events.Message) {
|
eh.Handle(events.ActionCreate, func(e events.Message) {
|
||||||
if opts.all {
|
if opts.all {
|
||||||
s := NewStats(e.ID[:12])
|
s := NewStats(e.Actor.ID[:12])
|
||||||
if cStats.add(s) {
|
if cStats.add(s) {
|
||||||
waitFirst.Add(1)
|
waitFirst.Add(1)
|
||||||
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
|
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
|
||||||
|
@ -144,7 +145,7 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
})
|
})
|
||||||
|
|
||||||
eh.Handle(events.ActionStart, func(e events.Message) {
|
eh.Handle(events.ActionStart, func(e events.Message) {
|
||||||
s := NewStats(e.ID[:12])
|
s := NewStats(e.Actor.ID[:12])
|
||||||
if cStats.add(s) {
|
if cStats.add(s) {
|
||||||
waitFirst.Add(1)
|
waitFirst.Add(1)
|
||||||
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
|
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
|
||||||
|
@ -153,7 +154,7 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
|
|
||||||
eh.Handle(events.ActionDie, func(e events.Message) {
|
eh.Handle(events.ActionDie, func(e events.Message) {
|
||||||
if !opts.all {
|
if !opts.all {
|
||||||
cStats.remove(e.ID[:12])
|
cStats.remove(e.Actor.ID[:12])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/moby/sys/signal"
|
"github.com/moby/sys/signal"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -21,7 +21,7 @@ func resizeTtyTo(ctx context.Context, client client.ContainerAPIClient, id strin
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
options := types.ResizeOptions{
|
options := container.ResizeOptions{
|
||||||
Height: height,
|
Height: height,
|
||||||
Width: width,
|
Width: width,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
func TestInitTtySizeErrors(t *testing.T) {
|
func TestInitTtySizeErrors(t *testing.T) {
|
||||||
expectedError := "failed to resize tty, using default size\n"
|
expectedError := "failed to resize tty, using default size\n"
|
||||||
fakeContainerExecResizeFunc := func(id string, options types.ResizeOptions) error {
|
fakeContainerExecResizeFunc := func(id string, options container.ResizeOptions) error {
|
||||||
return errors.Errorf("Error response from daemon: no such exec")
|
return errors.Errorf("Error response from daemon: no such exec")
|
||||||
}
|
}
|
||||||
fakeResizeTtyFunc := func(ctx context.Context, cli command.Cli, id string, isExec bool) error {
|
fakeResizeTtyFunc := func(ctx context.Context, cli command.Cli, id string, isExec bool) error {
|
||||||
|
|
|
@ -86,7 +86,7 @@ func legacyWaitExitOrRemoved(ctx context.Context, apiClient client.APIClient, co
|
||||||
// We need to fall back to the old behavior, which is client-side removal
|
// We need to fall back to the old behavior, which is client-side removal
|
||||||
if versions.LessThan(apiClient.ClientVersion(), "1.25") {
|
if versions.LessThan(apiClient.ClientVersion(), "1.25") {
|
||||||
go func() {
|
go func() {
|
||||||
removeErr = apiClient.ContainerRemove(ctx, containerID, types.ContainerRemoveOptions{RemoveVolumes: true})
|
removeErr = apiClient.ContainerRemove(ctx, containerID, container.RemoveOptions{RemoveVolumes: true})
|
||||||
if removeErr != nil {
|
if removeErr != nil {
|
||||||
logrus.Errorf("error removing container: %v", removeErr)
|
logrus.Errorf("error removing container: %v", removeErr)
|
||||||
cancel() // cancel the event Q
|
cancel() // cancel the event Q
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/docker/docker/api/types/volume"
|
"github.com/docker/docker/api/types/volume"
|
||||||
units "github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
@ -34,7 +35,7 @@ type DiskUsageContext struct {
|
||||||
Context
|
Context
|
||||||
Verbose bool
|
Verbose bool
|
||||||
LayersSize int64
|
LayersSize int64
|
||||||
Images []*types.ImageSummary
|
Images []*image.Summary
|
||||||
Containers []*types.Container
|
Containers []*types.Container
|
||||||
Volumes []*volume.Volume
|
Volumes []*volume.Volume
|
||||||
BuildCache []*types.BuildCache
|
BuildCache []*types.BuildCache
|
||||||
|
@ -261,7 +262,7 @@ func (ctx *DiskUsageContext) verboseWriteTable(duc *diskUsageContext) error {
|
||||||
type diskUsageImagesContext struct {
|
type diskUsageImagesContext struct {
|
||||||
HeaderContext
|
HeaderContext
|
||||||
totalSize int64
|
totalSize int64
|
||||||
images []*types.ImageSummary
|
images []*image.Summary
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *diskUsageImagesContext) MarshalJSON() ([]byte, error) {
|
func (c *diskUsageImagesContext) MarshalJSON() ([]byte, error) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
units "github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
@ -26,7 +26,7 @@ type ImageContext struct {
|
||||||
Digest bool
|
Digest bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func isDangling(image types.ImageSummary) bool {
|
func isDangling(image image.Summary) bool {
|
||||||
if len(image.RepoTags) == 0 && len(image.RepoDigests) == 0 {
|
if len(image.RepoTags) == 0 && len(image.RepoDigests) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ virtual_size: {{.Size}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageWrite writes the formatter images using the ImageContext
|
// ImageWrite writes the formatter images using the ImageContext
|
||||||
func ImageWrite(ctx ImageContext, images []types.ImageSummary) error {
|
func ImageWrite(ctx ImageContext, images []image.Summary) error {
|
||||||
render := func(format func(subContext SubContext) error) error {
|
render := func(format func(subContext SubContext) error) error {
|
||||||
return imageFormat(ctx, images, format)
|
return imageFormat(ctx, images, format)
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ func needDigest(ctx ImageContext) bool {
|
||||||
return ctx.Digest || ctx.Format.Contains("{{.Digest}}")
|
return ctx.Digest || ctx.Format.Contains("{{.Digest}}")
|
||||||
}
|
}
|
||||||
|
|
||||||
func imageFormat(ctx ImageContext, images []types.ImageSummary, format func(subContext SubContext) error) error {
|
func imageFormat(ctx ImageContext, images []image.Summary, format func(subContext SubContext) error) error {
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
formatted := []*imageContext{}
|
formatted := []*imageContext{}
|
||||||
if isDangling(image) {
|
if isDangling(image) {
|
||||||
|
@ -110,7 +110,7 @@ func imageFormat(ctx ImageContext, images []types.ImageSummary, format func(subC
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func imageFormatTaggedAndDigest(ctx ImageContext, image types.ImageSummary) []*imageContext {
|
func imageFormatTaggedAndDigest(ctx ImageContext, image image.Summary) []*imageContext {
|
||||||
repoTags := map[string][]string{}
|
repoTags := map[string][]string{}
|
||||||
repoDigests := map[string][]string{}
|
repoDigests := map[string][]string{}
|
||||||
images := []*imageContext{}
|
images := []*imageContext{}
|
||||||
|
@ -137,14 +137,13 @@ func imageFormatTaggedAndDigest(ctx ImageContext, image types.ImageSummary) []*i
|
||||||
}
|
}
|
||||||
|
|
||||||
addImage := func(repo, tag, digest string) {
|
addImage := func(repo, tag, digest string) {
|
||||||
image := &imageContext{
|
images = append(images, &imageContext{
|
||||||
trunc: ctx.Trunc,
|
trunc: ctx.Trunc,
|
||||||
i: image,
|
i: image,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
tag: tag,
|
tag: tag,
|
||||||
digest: digest,
|
digest: digest,
|
||||||
}
|
})
|
||||||
images = append(images, image)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for repo, tags := range repoTags {
|
for repo, tags := range repoTags {
|
||||||
|
@ -188,7 +187,7 @@ func imageFormatTaggedAndDigest(ctx ImageContext, image types.ImageSummary) []*i
|
||||||
type imageContext struct {
|
type imageContext struct {
|
||||||
HeaderContext
|
HeaderContext
|
||||||
trunc bool
|
trunc bool
|
||||||
i types.ImageSummary
|
i image.Summary
|
||||||
repo string
|
repo string
|
||||||
tag string
|
tag string
|
||||||
digest string
|
digest string
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
@ -26,66 +26,66 @@ func TestImageContext(t *testing.T) {
|
||||||
call func() string
|
call func() string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{ID: imageID}, trunc: true},
|
imageCtx: imageContext{i: image.Summary{ID: imageID}, trunc: true},
|
||||||
expValue: stringid.TruncateID(imageID),
|
expValue: stringid.TruncateID(imageID),
|
||||||
call: ctx.ID,
|
call: ctx.ID,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{ID: imageID}, trunc: false},
|
imageCtx: imageContext{i: image.Summary{ID: imageID}, trunc: false},
|
||||||
expValue: imageID,
|
expValue: imageID,
|
||||||
call: ctx.ID,
|
call: ctx.ID,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{Size: 10}, trunc: true},
|
imageCtx: imageContext{i: image.Summary{Size: 10}, trunc: true},
|
||||||
expValue: "10B",
|
expValue: "10B",
|
||||||
call: ctx.Size,
|
call: ctx.Size,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{Created: unix}, trunc: true},
|
imageCtx: imageContext{i: image.Summary{Created: unix}, trunc: true},
|
||||||
expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,
|
expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,
|
||||||
},
|
},
|
||||||
// FIXME
|
// FIXME
|
||||||
// {imageContext{
|
// {imageContext{
|
||||||
// i: types.ImageSummary{Created: unix},
|
// i: image.Summary{Created: unix},
|
||||||
// trunc: true,
|
// trunc: true,
|
||||||
// }, units.HumanDuration(time.Unix(unix, 0)), createdSinceHeader, ctx.CreatedSince},
|
// }, units.HumanDuration(time.Unix(unix, 0)), createdSinceHeader, ctx.CreatedSince},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{}, repo: "busybox"},
|
imageCtx: imageContext{i: image.Summary{}, repo: "busybox"},
|
||||||
expValue: "busybox",
|
expValue: "busybox",
|
||||||
call: ctx.Repository,
|
call: ctx.Repository,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{}, tag: "latest"},
|
imageCtx: imageContext{i: image.Summary{}, tag: "latest"},
|
||||||
expValue: "latest",
|
expValue: "latest",
|
||||||
call: ctx.Tag,
|
call: ctx.Tag,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{}, digest: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a"},
|
imageCtx: imageContext{i: image.Summary{}, digest: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a"},
|
||||||
expValue: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a",
|
expValue: "sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d850b2a2a67f2819a",
|
||||||
call: ctx.Digest,
|
call: ctx.Digest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{Containers: 10}},
|
imageCtx: imageContext{i: image.Summary{Containers: 10}},
|
||||||
expValue: "10",
|
expValue: "10",
|
||||||
call: ctx.Containers,
|
call: ctx.Containers,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{Size: 10000}},
|
imageCtx: imageContext{i: image.Summary{Size: 10000}},
|
||||||
expValue: "10kB",
|
expValue: "10kB",
|
||||||
call: ctx.VirtualSize, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
|
call: ctx.VirtualSize, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{SharedSize: 10000}},
|
imageCtx: imageContext{i: image.Summary{SharedSize: 10000}},
|
||||||
expValue: "10kB",
|
expValue: "10kB",
|
||||||
call: ctx.SharedSize,
|
call: ctx.SharedSize,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{SharedSize: 5000, Size: 20000}},
|
imageCtx: imageContext{i: image.Summary{SharedSize: 5000, Size: 20000}},
|
||||||
expValue: "15kB",
|
expValue: "15kB",
|
||||||
call: ctx.UniqueSize,
|
call: ctx.UniqueSize,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageCtx: imageContext{i: types.ImageSummary{Created: zeroTime}},
|
imageCtx: imageContext{i: image.Summary{Created: zeroTime}},
|
||||||
expValue: "",
|
expValue: "",
|
||||||
call: ctx.CreatedSince,
|
call: ctx.CreatedSince,
|
||||||
},
|
},
|
||||||
|
@ -297,7 +297,7 @@ image_id: imageID3
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
images := []types.ImageSummary{
|
images := []image.Summary{
|
||||||
{ID: "imageID1", RepoTags: []string{"image:tag1"}, RepoDigests: []string{"image@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"}, Created: unixTime},
|
{ID: "imageID1", RepoTags: []string{"image:tag1"}, RepoDigests: []string{"image@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"}, Created: unixTime},
|
||||||
{ID: "imageID2", RepoTags: []string{"image:tag2"}, Created: zeroTime},
|
{ID: "imageID2", RepoTags: []string{"image:tag2"}, Created: zeroTime},
|
||||||
{ID: "imageID3", RepoTags: []string{"<none>:<none>"}, RepoDigests: []string{"<none>@<none>"}, Created: unixTime},
|
{ID: "imageID3", RepoTags: []string{"<none>:<none>"}, RepoDigests: []string{"<none>@<none>"}, Created: unixTime},
|
||||||
|
@ -320,7 +320,7 @@ image_id: imageID3
|
||||||
|
|
||||||
func TestImageContextWriteWithNoImage(t *testing.T) {
|
func TestImageContextWriteWithNoImage(t *testing.T) {
|
||||||
out := bytes.NewBufferString("")
|
out := bytes.NewBufferString("")
|
||||||
images := []types.ImageSummary{}
|
images := []image.Summary{}
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
context ImageContext
|
context ImageContext
|
||||||
|
|
|
@ -17,13 +17,13 @@ type fakeClient struct {
|
||||||
client.Client
|
client.Client
|
||||||
imageTagFunc func(string, string) error
|
imageTagFunc func(string, string) error
|
||||||
imageSaveFunc func(images []string) (io.ReadCloser, error)
|
imageSaveFunc func(images []string) (io.ReadCloser, error)
|
||||||
imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
|
imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error)
|
||||||
imagePushFunc func(ref string, options types.ImagePushOptions) (io.ReadCloser, error)
|
imagePushFunc func(ref string, options types.ImagePushOptions) (io.ReadCloser, error)
|
||||||
infoFunc func() (system.Info, error)
|
infoFunc func() (system.Info, error)
|
||||||
imagePullFunc func(ref string, options types.ImagePullOptions) (io.ReadCloser, error)
|
imagePullFunc func(ref string, options types.ImagePullOptions) (io.ReadCloser, error)
|
||||||
imagesPruneFunc func(pruneFilter filters.Args) (types.ImagesPruneReport, error)
|
imagesPruneFunc func(pruneFilter filters.Args) (types.ImagesPruneReport, error)
|
||||||
imageLoadFunc func(input io.Reader, quiet bool) (types.ImageLoadResponse, error)
|
imageLoadFunc func(input io.Reader, quiet bool) (types.ImageLoadResponse, error)
|
||||||
imageListFunc func(options types.ImageListOptions) ([]types.ImageSummary, error)
|
imageListFunc func(options types.ImageListOptions) ([]image.Summary, error)
|
||||||
imageInspectFunc func(image string) (types.ImageInspect, []byte, error)
|
imageInspectFunc func(image string) (types.ImageInspect, []byte, error)
|
||||||
imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
|
imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
|
||||||
imageHistoryFunc func(image string) ([]image.HistoryResponseItem, error)
|
imageHistoryFunc func(image string) ([]image.HistoryResponseItem, error)
|
||||||
|
@ -44,13 +44,13 @@ func (cli *fakeClient) ImageSave(_ context.Context, images []string) (io.ReadClo
|
||||||
return io.NopCloser(strings.NewReader("")), nil
|
return io.NopCloser(strings.NewReader("")), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ImageRemove(_ context.Context, image string,
|
func (cli *fakeClient) ImageRemove(_ context.Context, img string,
|
||||||
options types.ImageRemoveOptions,
|
options types.ImageRemoveOptions,
|
||||||
) ([]types.ImageDeleteResponseItem, error) {
|
) ([]image.DeleteResponse, error) {
|
||||||
if cli.imageRemoveFunc != nil {
|
if cli.imageRemoveFunc != nil {
|
||||||
return cli.imageRemoveFunc(image, options)
|
return cli.imageRemoveFunc(img, options)
|
||||||
}
|
}
|
||||||
return []types.ImageDeleteResponseItem{}, nil
|
return []image.DeleteResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ImagePush(_ context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
|
func (cli *fakeClient) ImagePush(_ context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
|
||||||
|
@ -88,11 +88,11 @@ func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, quiet bool)
|
||||||
return types.ImageLoadResponse{}, nil
|
return types.ImageLoadResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ImageList(_ context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) {
|
func (cli *fakeClient) ImageList(_ context.Context, options types.ImageListOptions) ([]image.Summary, error) {
|
||||||
if cli.imageListFunc != nil {
|
if cli.imageListFunc != nil {
|
||||||
return cli.imageListFunc(options)
|
return cli.imageListFunc(options)
|
||||||
}
|
}
|
||||||
return []types.ImageSummary{}, nil
|
return []image.Summary{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, image string) (types.ImageInspect, []byte, error) {
|
func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, image string) (types.ImageInspect, []byte, error) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/docker/cli/cli/config/configfile"
|
"github.com/docker/cli/cli/config/configfile"
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
@ -19,7 +20,7 @@ func TestNewImagesCommandErrors(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
expectedError string
|
expectedError string
|
||||||
imageListFunc func(options types.ImageListOptions) ([]types.ImageSummary, error)
|
imageListFunc func(options types.ImageListOptions) ([]image.Summary, error)
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "wrong-args",
|
name: "wrong-args",
|
||||||
|
@ -29,8 +30,8 @@ func TestNewImagesCommandErrors(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "failed-list",
|
name: "failed-list",
|
||||||
expectedError: "something went wrong",
|
expectedError: "something went wrong",
|
||||||
imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) {
|
imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) {
|
||||||
return []types.ImageSummary{}, errors.Errorf("something went wrong")
|
return []image.Summary{}, errors.Errorf("something went wrong")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -47,7 +48,7 @@ func TestNewImagesCommandSuccess(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
imageFormat string
|
imageFormat string
|
||||||
imageListFunc func(options types.ImageListOptions) ([]types.ImageSummary, error)
|
imageListFunc func(options types.ImageListOptions) ([]image.Summary, error)
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "simple",
|
name: "simple",
|
||||||
|
@ -64,17 +65,17 @@ func TestNewImagesCommandSuccess(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "match-name",
|
name: "match-name",
|
||||||
args: []string{"image"},
|
args: []string{"image"},
|
||||||
imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) {
|
imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) {
|
||||||
assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0]))
|
assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0]))
|
||||||
return []types.ImageSummary{}, nil
|
return []image.Summary{}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "filters",
|
name: "filters",
|
||||||
args: []string{"--filter", "name=value"},
|
args: []string{"--filter", "name=value"},
|
||||||
imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) {
|
imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) {
|
||||||
assert.Check(t, is.Equal("value", options.Filters.Get("name")[0]))
|
assert.Check(t, is.Equal("value", options.Filters.Get("name")[0]))
|
||||||
return []types.ImageSummary{}, nil
|
return []image.Summary{}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
@ -65,7 +66,7 @@ func TestNewPruneCommandSuccess(t *testing.T) {
|
||||||
imagesPruneFunc: func(pruneFilter filters.Args) (types.ImagesPruneReport, error) {
|
imagesPruneFunc: func(pruneFilter filters.Args) (types.ImagesPruneReport, error) {
|
||||||
assert.Check(t, is.Equal("true", pruneFilter.Get("dangling")[0]))
|
assert.Check(t, is.Equal("true", pruneFilter.Get("dangling")[0]))
|
||||||
return types.ImagesPruneReport{
|
return types.ImagesPruneReport{
|
||||||
ImagesDeleted: []types.ImageDeleteResponseItem{{Deleted: "image1"}},
|
ImagesDeleted: []image.DeleteResponse{{Deleted: "image1"}},
|
||||||
SpaceReclaimed: 1,
|
SpaceReclaimed: 1,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
|
@ -84,7 +85,7 @@ func TestNewPruneCommandSuccess(t *testing.T) {
|
||||||
imagesPruneFunc: func(pruneFilter filters.Args) (types.ImagesPruneReport, error) {
|
imagesPruneFunc: func(pruneFilter filters.Args) (types.ImagesPruneReport, error) {
|
||||||
assert.Check(t, is.Equal("true", pruneFilter.Get("dangling")[0]))
|
assert.Check(t, is.Equal("true", pruneFilter.Get("dangling")[0]))
|
||||||
return types.ImagesPruneReport{
|
return types.ImagesPruneReport{
|
||||||
ImagesDeleted: []types.ImageDeleteResponseItem{{Untagged: "image1"}},
|
ImagesDeleted: []image.DeleteResponse{{Untagged: "image1"}},
|
||||||
SpaceReclaimed: 2,
|
SpaceReclaimed: 2,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
@ -35,7 +36,7 @@ func TestNewRemoveCommandErrors(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
expectedError string
|
expectedError string
|
||||||
imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
|
imageRemoveFunc func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error)
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "wrong args",
|
name: "wrong args",
|
||||||
|
@ -45,19 +46,19 @@ func TestNewRemoveCommandErrors(t *testing.T) {
|
||||||
name: "ImageRemove fail with force option",
|
name: "ImageRemove fail with force option",
|
||||||
args: []string{"-f", "image1"},
|
args: []string{"-f", "image1"},
|
||||||
expectedError: "error removing image",
|
expectedError: "error removing image",
|
||||||
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
assert.Check(t, is.Equal("image1", image))
|
assert.Check(t, is.Equal("image1", img))
|
||||||
return []types.ImageDeleteResponseItem{}, errors.Errorf("error removing image")
|
return []image.DeleteResponse{}, errors.Errorf("error removing image")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ImageRemove fail",
|
name: "ImageRemove fail",
|
||||||
args: []string{"arg1"},
|
args: []string{"arg1"},
|
||||||
expectedError: "error removing image",
|
expectedError: "error removing image",
|
||||||
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
assert.Check(t, !options.Force)
|
assert.Check(t, !options.Force)
|
||||||
assert.Check(t, options.PruneChildren)
|
assert.Check(t, options.PruneChildren)
|
||||||
return []types.ImageDeleteResponseItem{}, errors.Errorf("error removing image")
|
return []image.DeleteResponse{}, errors.Errorf("error removing image")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -77,24 +78,24 @@ func TestNewRemoveCommandSuccess(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
|
imageRemoveFunc func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error)
|
||||||
expectedStderr string
|
expectedStderr string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Image Deleted",
|
name: "Image Deleted",
|
||||||
args: []string{"image1"},
|
args: []string{"image1"},
|
||||||
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
assert.Check(t, is.Equal("image1", image))
|
assert.Check(t, is.Equal("image1", img))
|
||||||
return []types.ImageDeleteResponseItem{{Deleted: image}}, nil
|
return []image.DeleteResponse{{Deleted: img}}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Image not found with force option",
|
name: "Image not found with force option",
|
||||||
args: []string{"-f", "image1"},
|
args: []string{"-f", "image1"},
|
||||||
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
assert.Check(t, is.Equal("image1", image))
|
assert.Check(t, is.Equal("image1", img))
|
||||||
assert.Check(t, is.Equal(true, options.Force))
|
assert.Check(t, is.Equal(true, options.Force))
|
||||||
return []types.ImageDeleteResponseItem{}, notFound{"image1"}
|
return []image.DeleteResponse{}, notFound{"image1"}
|
||||||
},
|
},
|
||||||
expectedStderr: "Error: No such image: image1\n",
|
expectedStderr: "Error: No such image: image1\n",
|
||||||
},
|
},
|
||||||
|
@ -102,19 +103,19 @@ func TestNewRemoveCommandSuccess(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "Image Untagged",
|
name: "Image Untagged",
|
||||||
args: []string{"image1"},
|
args: []string{"image1"},
|
||||||
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
assert.Check(t, is.Equal("image1", image))
|
assert.Check(t, is.Equal("image1", img))
|
||||||
return []types.ImageDeleteResponseItem{{Untagged: image}}, nil
|
return []image.DeleteResponse{{Untagged: img}}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Image Deleted and Untagged",
|
name: "Image Deleted and Untagged",
|
||||||
args: []string{"image1", "image2"},
|
args: []string{"image1", "image2"},
|
||||||
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
if image == "image1" {
|
if img == "image1" {
|
||||||
return []types.ImageDeleteResponseItem{{Untagged: image}}, nil
|
return []image.DeleteResponse{{Untagged: img}}, nil
|
||||||
}
|
}
|
||||||
return []types.ImageDeleteResponseItem{{Deleted: image}}, nil
|
return []image.DeleteResponse{{Deleted: img}}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
type fakeClient struct {
|
type fakeClient struct {
|
||||||
client.Client
|
client.Client
|
||||||
serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
||||||
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
|
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
|
||||||
serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
|
serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
|
||||||
taskListFunc func(context.Context, types.TaskListOptions) ([]swarm.Task, error)
|
taskListFunc func(context.Context, types.TaskListOptions) ([]swarm.Task, error)
|
||||||
infoFunc func(ctx context.Context) (system.Info, error)
|
infoFunc func(ctx context.Context) (system.Info, error)
|
||||||
|
@ -51,12 +51,12 @@ func (f *fakeClient) ServiceList(ctx context.Context, options types.ServiceListO
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
if f.serviceUpdateFunc != nil {
|
if f.serviceUpdateFunc != nil {
|
||||||
return f.serviceUpdateFunc(ctx, serviceID, version, service, options)
|
return f.serviceUpdateFunc(ctx, serviceID, version, service, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.ServiceUpdateResponse{}, nil
|
return swarm.ServiceUpdateResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeClient) Info(ctx context.Context) (system.Info, error) {
|
func (f *fakeClient) Info(ctx context.Context) (system.Info, error) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/docker/cli/cli/command/idresolver"
|
"github.com/docker/cli/cli/command/idresolver"
|
||||||
"github.com/docker/cli/service/logs"
|
"github.com/docker/cli/service/logs"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
|
@ -74,19 +75,7 @@ func newLogsCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
options := types.ContainerLogsOptions{
|
apiClient := dockerCli.Client()
|
||||||
ShowStdout: true,
|
|
||||||
ShowStderr: true,
|
|
||||||
Since: opts.since,
|
|
||||||
Timestamps: opts.timestamps,
|
|
||||||
Follow: opts.follow,
|
|
||||||
Tail: opts.tail,
|
|
||||||
// get the details if we request it OR if we're not doing raw mode
|
|
||||||
// (we need them for the context to pretty print)
|
|
||||||
Details: opts.details || !opts.raw,
|
|
||||||
}
|
|
||||||
|
|
||||||
cli := dockerCli.Client()
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
maxLength = 1
|
maxLength = 1
|
||||||
|
@ -94,16 +83,16 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
tty bool
|
tty bool
|
||||||
// logfunc is used to delay the call to logs so that we can do some
|
// logfunc is used to delay the call to logs so that we can do some
|
||||||
// processing before we actually get the logs
|
// processing before we actually get the logs
|
||||||
logfunc func(context.Context, string, types.ContainerLogsOptions) (io.ReadCloser, error)
|
logfunc func(context.Context, string, container.LogsOptions) (io.ReadCloser, error)
|
||||||
)
|
)
|
||||||
|
|
||||||
service, _, err := cli.ServiceInspectWithRaw(ctx, opts.target, types.ServiceInspectOptions{})
|
service, _, err := apiClient.ServiceInspectWithRaw(ctx, opts.target, types.ServiceInspectOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if it's any error other than service not found, it's Real
|
// if it's any error other than service not found, it's Real
|
||||||
if !errdefs.IsNotFound(err) {
|
if !errdefs.IsNotFound(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
task, _, err := cli.TaskInspectWithRaw(ctx, opts.target)
|
task, _, err := apiClient.TaskInspectWithRaw(ctx, opts.target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errdefs.IsNotFound(err) {
|
if errdefs.IsNotFound(err) {
|
||||||
// if the task isn't found, rewrite the error to be clear
|
// if the task isn't found, rewrite the error to be clear
|
||||||
|
@ -117,10 +106,10 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
maxLength = getMaxLength(task.Slot)
|
maxLength = getMaxLength(task.Slot)
|
||||||
|
|
||||||
// use the TaskLogs api function
|
// use the TaskLogs api function
|
||||||
logfunc = cli.TaskLogs
|
logfunc = apiClient.TaskLogs
|
||||||
} else {
|
} else {
|
||||||
// use ServiceLogs api function
|
// use ServiceLogs api function
|
||||||
logfunc = cli.ServiceLogs
|
logfunc = apiClient.ServiceLogs
|
||||||
tty = service.Spec.TaskTemplate.ContainerSpec.TTY
|
tty = service.Spec.TaskTemplate.ContainerSpec.TTY
|
||||||
if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil {
|
if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil {
|
||||||
// if replicas are initialized, figure out if we need to pad them
|
// if replicas are initialized, figure out if we need to pad them
|
||||||
|
@ -138,7 +127,17 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// now get the logs
|
// now get the logs
|
||||||
responseBody, err = logfunc(ctx, opts.target, options)
|
responseBody, err = logfunc(ctx, opts.target, container.LogsOptions{
|
||||||
|
ShowStdout: true,
|
||||||
|
ShowStderr: true,
|
||||||
|
Since: opts.since,
|
||||||
|
Timestamps: opts.timestamps,
|
||||||
|
Follow: opts.follow,
|
||||||
|
Tail: opts.tail,
|
||||||
|
// get the details if we request it OR if we're not doing raw mode
|
||||||
|
// (we need them for the context to pretty print)
|
||||||
|
Details: opts.details || !opts.raw,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -156,7 +155,7 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
stdout = dockerCli.Out()
|
stdout = dockerCli.Out()
|
||||||
stderr = dockerCli.Err()
|
stderr = dockerCli.Err()
|
||||||
if !opts.raw {
|
if !opts.raw {
|
||||||
taskFormatter := newTaskFormatter(cli, opts, maxLength)
|
taskFormatter := newTaskFormatter(apiClient, opts, maxLength)
|
||||||
|
|
||||||
stdout = &logWriter{ctx: ctx, opts: opts, f: taskFormatter, w: stdout}
|
stdout = &logWriter{ctx: ctx, opts: opts, f: taskFormatter, w: stdout}
|
||||||
stderr = &logWriter{ctx: ctx, opts: opts, f: taskFormatter, w: stderr}
|
stderr = &logWriter{ctx: ctx, opts: opts, f: taskFormatter, w: stderr}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestRollback(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
|
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
|
||||||
expectedDockerCliErr string
|
expectedDockerCliErr string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
@ -28,8 +28,8 @@ func TestRollback(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "rollback-service-with-warnings",
|
name: "rollback-service-with-warnings",
|
||||||
args: []string{"service-id"},
|
args: []string{"service-id"},
|
||||||
serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
response := types.ServiceUpdateResponse{}
|
response := swarm.ServiceUpdateResponse{}
|
||||||
|
|
||||||
response.Warnings = []string{
|
response.Warnings = []string{
|
||||||
"- warning 1",
|
"- warning 1",
|
||||||
|
@ -60,7 +60,7 @@ func TestRollbackWithErrors(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
||||||
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
|
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
|
||||||
expectedError string
|
expectedError string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
@ -83,8 +83,8 @@ func TestRollbackWithErrors(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "service-update-failed",
|
name: "service-update-failed",
|
||||||
args: []string{"service-id"},
|
args: []string{"service-id"},
|
||||||
serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
return types.ServiceUpdateResponse{}, fmt.Errorf("no such services: %s", serviceID)
|
return swarm.ServiceUpdateResponse{}, fmt.Errorf("no such services: %s", serviceID)
|
||||||
},
|
},
|
||||||
expectedError: "no such services: service-id",
|
expectedError: "no such services: service-id",
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,7 +35,7 @@ type fakeClient struct {
|
||||||
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
|
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
|
||||||
nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error)
|
nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error)
|
||||||
|
|
||||||
serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
|
serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
|
||||||
|
|
||||||
serviceRemoveFunc func(serviceID string) error
|
serviceRemoveFunc func(serviceID string) error
|
||||||
networkRemoveFunc func(networkID string) error
|
networkRemoveFunc func(networkID string) error
|
||||||
|
@ -135,12 +135,12 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm.
|
||||||
return swarm.Node{}, nil, nil
|
return swarm.Node{}, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
if cli.serviceUpdateFunc != nil {
|
if cli.serviceUpdateFunc != nil {
|
||||||
return cli.serviceUpdateFunc(serviceID, version, service, options)
|
return cli.serviceUpdateFunc(serviceID, version, service, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.ServiceUpdateResponse{}, nil
|
return swarm.ServiceUpdateResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ServiceRemove(_ context.Context, serviceID string) error {
|
func (cli *fakeClient) ServiceRemove(_ context.Context, serviceID string) error {
|
||||||
|
|
|
@ -35,7 +35,7 @@ type fakeClient struct {
|
||||||
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
|
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
|
||||||
nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error)
|
nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error)
|
||||||
|
|
||||||
serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
|
serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
|
||||||
|
|
||||||
serviceRemoveFunc func(serviceID string) error
|
serviceRemoveFunc func(serviceID string) error
|
||||||
networkRemoveFunc func(networkID string) error
|
networkRemoveFunc func(networkID string) error
|
||||||
|
@ -135,12 +135,12 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm.
|
||||||
return swarm.Node{}, nil, nil
|
return swarm.Node{}, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
if cli.serviceUpdateFunc != nil {
|
if cli.serviceUpdateFunc != nil {
|
||||||
return cli.serviceUpdateFunc(serviceID, version, service, options)
|
return cli.serviceUpdateFunc(serviceID, version, service, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.ServiceUpdateResponse{}, nil
|
return swarm.ServiceUpdateResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *fakeClient) ServiceRemove(_ context.Context, serviceID string) error {
|
func (cli *fakeClient) ServiceRemove(_ context.Context, serviceID string) error {
|
||||||
|
|
|
@ -56,10 +56,10 @@ func TestServiceUpdateResolveImageChanged(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
serviceUpdateFunc: func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
serviceUpdateFunc: func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
receivedOptions = options
|
receivedOptions = options
|
||||||
receivedService = service
|
receivedService = service
|
||||||
return types.ServiceUpdateResponse{}, nil
|
return swarm.ServiceUpdateResponse{}, nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ require (
|
||||||
github.com/creack/pty v1.1.18
|
github.com/creack/pty v1.1.18
|
||||||
github.com/distribution/reference v0.5.0
|
github.com/distribution/reference v0.5.0
|
||||||
github.com/docker/distribution v2.8.3+incompatible
|
github.com/docker/distribution v2.8.3+incompatible
|
||||||
github.com/docker/docker v24.0.0-rc.2.0.20230921123131-d3afa80b96bf+incompatible // master (v25.0.0-dev)
|
github.com/docker/docker v24.0.0-rc.2.0.20231013183648-cdb3f9fb8dca+incompatible // master (v25.0.0-dev)
|
||||||
github.com/docker/docker-credential-helpers v0.8.0
|
github.com/docker/docker-credential-helpers v0.8.0
|
||||||
github.com/docker/go-connections v0.4.0
|
github.com/docker/go-connections v0.4.0
|
||||||
github.com/docker/go-units v0.5.0
|
github.com/docker/go-units v0.5.0
|
||||||
|
|
|
@ -56,8 +56,8 @@ github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5
|
||||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
||||||
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/docker v24.0.0-rc.2.0.20230921123131-d3afa80b96bf+incompatible h1:4TeclqMx5eFwUUQiHqXCB3fMBPxTWVdrILSKISy3IKc=
|
github.com/docker/docker v24.0.0-rc.2.0.20231013183648-cdb3f9fb8dca+incompatible h1:dPyJJJlyetVDyMqY664Mopg71y+2yY5RQ4VN90ZChds=
|
||||||
github.com/docker/docker v24.0.0-rc.2.0.20230921123131-d3afa80b96bf+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v24.0.0-rc.2.0.20231013183648-cdb3f9fb8dca+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8=
|
github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8=
|
||||||
github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40=
|
github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40=
|
||||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
||||||
|
|
|
@ -1840,6 +1840,7 @@ definitions:
|
||||||
x-nullable: true
|
x-nullable: true
|
||||||
ImageSummary:
|
ImageSummary:
|
||||||
type: "object"
|
type: "object"
|
||||||
|
x-go-name: "Summary"
|
||||||
required:
|
required:
|
||||||
- Id
|
- Id
|
||||||
- ParentId
|
- ParentId
|
||||||
|
@ -3553,6 +3554,32 @@ definitions:
|
||||||
Level:
|
Level:
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "SELinux level label"
|
description: "SELinux level label"
|
||||||
|
Seccomp:
|
||||||
|
type: "object"
|
||||||
|
description: "Options for configuring seccomp on the container"
|
||||||
|
properties:
|
||||||
|
Mode:
|
||||||
|
type: "string"
|
||||||
|
enum:
|
||||||
|
- "default"
|
||||||
|
- "unconfined"
|
||||||
|
- "custom"
|
||||||
|
Profile:
|
||||||
|
description: "The custom seccomp profile as a json object"
|
||||||
|
type: "string"
|
||||||
|
AppArmor:
|
||||||
|
type: "object"
|
||||||
|
description: "Options for configuring AppArmor on the container"
|
||||||
|
properties:
|
||||||
|
Mode:
|
||||||
|
type: "string"
|
||||||
|
enum:
|
||||||
|
- "default"
|
||||||
|
- "disabled"
|
||||||
|
NoNewPrivileges:
|
||||||
|
type: "boolean"
|
||||||
|
description: "Configuration of the no_new_privs bit in the container"
|
||||||
|
|
||||||
TTY:
|
TTY:
|
||||||
description: "Whether a pseudo-TTY should be allocated."
|
description: "Whether a pseudo-TTY should be allocated."
|
||||||
type: "boolean"
|
type: "boolean"
|
||||||
|
@ -4451,6 +4478,7 @@ definitions:
|
||||||
|
|
||||||
ImageDeleteResponseItem:
|
ImageDeleteResponseItem:
|
||||||
type: "object"
|
type: "object"
|
||||||
|
x-go-name: "DeleteResponse"
|
||||||
properties:
|
properties:
|
||||||
Untagged:
|
Untagged:
|
||||||
description: "The image ID of an image that was untagged"
|
description: "The image ID of an image that was untagged"
|
||||||
|
@ -4459,6 +4487,29 @@ definitions:
|
||||||
description: "The image ID of an image that was deleted"
|
description: "The image ID of an image that was deleted"
|
||||||
type: "string"
|
type: "string"
|
||||||
|
|
||||||
|
ServiceCreateResponse:
|
||||||
|
type: "object"
|
||||||
|
description: |
|
||||||
|
contains the information returned to a client on the
|
||||||
|
creation of a new service.
|
||||||
|
properties:
|
||||||
|
ID:
|
||||||
|
description: "The ID of the created service."
|
||||||
|
type: "string"
|
||||||
|
x-nullable: false
|
||||||
|
example: "ak7w3gjqoa3kuz8xcpnyy0pvl"
|
||||||
|
Warnings:
|
||||||
|
description: |
|
||||||
|
Optional warning message.
|
||||||
|
|
||||||
|
FIXME(thaJeztah): this should have "omitempty" in the generated type.
|
||||||
|
type: "array"
|
||||||
|
x-nullable: true
|
||||||
|
items:
|
||||||
|
type: "string"
|
||||||
|
example:
|
||||||
|
- "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
|
||||||
|
|
||||||
ServiceUpdateResponse:
|
ServiceUpdateResponse:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
|
@ -4468,7 +4519,8 @@ definitions:
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
example:
|
example:
|
||||||
Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
|
Warnings:
|
||||||
|
- "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
|
||||||
|
|
||||||
ContainerSummary:
|
ContainerSummary:
|
||||||
type: "object"
|
type: "object"
|
||||||
|
@ -11071,18 +11123,7 @@ paths:
|
||||||
201:
|
201:
|
||||||
description: "no error"
|
description: "no error"
|
||||||
schema:
|
schema:
|
||||||
type: "object"
|
$ref: "#/definitions/ServiceCreateResponse"
|
||||||
title: "ServiceCreateResponse"
|
|
||||||
properties:
|
|
||||||
ID:
|
|
||||||
description: "The ID of the created service."
|
|
||||||
type: "string"
|
|
||||||
Warning:
|
|
||||||
description: "Optional warning message"
|
|
||||||
type: "string"
|
|
||||||
example:
|
|
||||||
ID: "ak7w3gjqoa3kuz8xcpnyy0pvl"
|
|
||||||
Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
|
|
||||||
400:
|
400:
|
||||||
description: "bad parameter"
|
description: "bad parameter"
|
||||||
schema:
|
schema:
|
||||||
|
|
|
@ -11,26 +11,6 @@ import (
|
||||||
units "github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerAttachOptions holds parameters to attach to a container.
|
|
||||||
type ContainerAttachOptions struct {
|
|
||||||
Stream bool
|
|
||||||
Stdin bool
|
|
||||||
Stdout bool
|
|
||||||
Stderr bool
|
|
||||||
DetachKeys string
|
|
||||||
Logs bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerCommitOptions holds parameters to commit changes into a container.
|
|
||||||
type ContainerCommitOptions struct {
|
|
||||||
Reference string
|
|
||||||
Comment string
|
|
||||||
Author string
|
|
||||||
Changes []string
|
|
||||||
Pause bool
|
|
||||||
Config *container.Config
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerExecInspect holds information returned by exec inspect.
|
// ContainerExecInspect holds information returned by exec inspect.
|
||||||
type ContainerExecInspect struct {
|
type ContainerExecInspect struct {
|
||||||
ExecID string `json:"ID"`
|
ExecID string `json:"ID"`
|
||||||
|
@ -40,42 +20,6 @@ type ContainerExecInspect struct {
|
||||||
Pid int
|
Pid int
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerListOptions holds parameters to list containers with.
|
|
||||||
type ContainerListOptions struct {
|
|
||||||
Size bool
|
|
||||||
All bool
|
|
||||||
Latest bool
|
|
||||||
Since string
|
|
||||||
Before string
|
|
||||||
Limit int
|
|
||||||
Filters filters.Args
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerLogsOptions holds parameters to filter logs with.
|
|
||||||
type ContainerLogsOptions struct {
|
|
||||||
ShowStdout bool
|
|
||||||
ShowStderr bool
|
|
||||||
Since string
|
|
||||||
Until string
|
|
||||||
Timestamps bool
|
|
||||||
Follow bool
|
|
||||||
Tail string
|
|
||||||
Details bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerRemoveOptions holds parameters to remove containers.
|
|
||||||
type ContainerRemoveOptions struct {
|
|
||||||
RemoveVolumes bool
|
|
||||||
RemoveLinks bool
|
|
||||||
Force bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerStartOptions holds parameters to start containers.
|
|
||||||
type ContainerStartOptions struct {
|
|
||||||
CheckpointID string
|
|
||||||
CheckpointDir string
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyToContainerOptions holds information
|
// CopyToContainerOptions holds information
|
||||||
// about files to copy into a container
|
// about files to copy into a container
|
||||||
type CopyToContainerOptions struct {
|
type CopyToContainerOptions struct {
|
||||||
|
@ -289,14 +233,6 @@ type ImageSearchOptions struct {
|
||||||
Limit int
|
Limit int
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResizeOptions holds parameters to resize a tty.
|
|
||||||
// It can be used to resize container ttys and
|
|
||||||
// exec process ttys too.
|
|
||||||
type ResizeOptions struct {
|
|
||||||
Height uint
|
|
||||||
Width uint
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeListOptions holds parameters to list nodes with.
|
// NodeListOptions holds parameters to list nodes with.
|
||||||
type NodeListOptions struct {
|
type NodeListOptions struct {
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
|
@ -322,15 +258,6 @@ type ServiceCreateOptions struct {
|
||||||
QueryRegistry bool
|
QueryRegistry bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServiceCreateResponse contains the information returned to a client
|
|
||||||
// on the creation of a new service.
|
|
||||||
type ServiceCreateResponse struct {
|
|
||||||
// ID is the ID of the created service.
|
|
||||||
ID string
|
|
||||||
// Warnings is a set of non-fatal warning messages to pass on to the user.
|
|
||||||
Warnings []string `json:",omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Values for RegistryAuthFrom in ServiceUpdateOptions
|
// Values for RegistryAuthFrom in ServiceUpdateOptions
|
||||||
const (
|
const (
|
||||||
RegistryAuthFromSpec = "spec"
|
RegistryAuthFromSpec = "spec"
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package container
|
||||||
|
|
||||||
|
import "github.com/docker/docker/api/types/filters"
|
||||||
|
|
||||||
|
// ResizeOptions holds parameters to resize a TTY.
|
||||||
|
// It can be used to resize container TTYs and
|
||||||
|
// exec process TTYs too.
|
||||||
|
type ResizeOptions struct {
|
||||||
|
Height uint
|
||||||
|
Width uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// AttachOptions holds parameters to attach to a container.
|
||||||
|
type AttachOptions struct {
|
||||||
|
Stream bool
|
||||||
|
Stdin bool
|
||||||
|
Stdout bool
|
||||||
|
Stderr bool
|
||||||
|
DetachKeys string
|
||||||
|
Logs bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommitOptions holds parameters to commit changes into a container.
|
||||||
|
type CommitOptions struct {
|
||||||
|
Reference string
|
||||||
|
Comment string
|
||||||
|
Author string
|
||||||
|
Changes []string
|
||||||
|
Pause bool
|
||||||
|
Config *Config
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveOptions holds parameters to remove containers.
|
||||||
|
type RemoveOptions struct {
|
||||||
|
RemoveVolumes bool
|
||||||
|
RemoveLinks bool
|
||||||
|
Force bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOptions holds parameters to start containers.
|
||||||
|
type StartOptions struct {
|
||||||
|
CheckpointID string
|
||||||
|
CheckpointDir string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListOptions holds parameters to list containers with.
|
||||||
|
type ListOptions struct {
|
||||||
|
Size bool
|
||||||
|
All bool
|
||||||
|
Latest bool
|
||||||
|
Since string
|
||||||
|
Before string
|
||||||
|
Limit int
|
||||||
|
Filters filters.Args
|
||||||
|
}
|
||||||
|
|
||||||
|
// LogsOptions holds parameters to filter logs with.
|
||||||
|
type LogsOptions struct {
|
||||||
|
ShowStdout bool
|
||||||
|
ShowStderr bool
|
||||||
|
Since string
|
||||||
|
Until string
|
||||||
|
Timestamps bool
|
||||||
|
Follow bool
|
||||||
|
Tail string
|
||||||
|
Details bool
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package types
|
package image
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
// ImageDeleteResponseItem image delete response item
|
// DeleteResponse delete response
|
||||||
// swagger:model ImageDeleteResponseItem
|
// swagger:model DeleteResponse
|
||||||
type ImageDeleteResponseItem struct {
|
type DeleteResponse struct {
|
||||||
|
|
||||||
// The image ID of an image that was deleted
|
// The image ID of an image that was deleted
|
||||||
Deleted string `json:"Deleted,omitempty"`
|
Deleted string `json:"Deleted,omitempty"`
|
|
@ -0,0 +1,9 @@
|
||||||
|
package image
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// Metadata contains engine-local data about the image.
|
||||||
|
type Metadata struct {
|
||||||
|
// LastTagTime is the date and time at which the image was last tagged.
|
||||||
|
LastTagTime time.Time `json:",omitempty"`
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package types
|
package image
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
// ImageSummary image summary
|
// Summary summary
|
||||||
// swagger:model ImageSummary
|
// swagger:model Summary
|
||||||
type ImageSummary struct {
|
type Summary struct {
|
||||||
|
|
||||||
// Number of containers using this image. Includes both stopped and running
|
// Number of containers using this image. Includes both stopped and running
|
||||||
// containers.
|
// containers.
|
|
@ -32,6 +32,42 @@ type SELinuxContext struct {
|
||||||
Level string
|
Level string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SeccompMode is the type used for the enumeration of possible seccomp modes
|
||||||
|
// in SeccompOpts
|
||||||
|
type SeccompMode string
|
||||||
|
|
||||||
|
const (
|
||||||
|
SeccompModeDefault SeccompMode = "default"
|
||||||
|
SeccompModeUnconfined SeccompMode = "unconfined"
|
||||||
|
SeccompModeCustom SeccompMode = "custom"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SeccompOpts defines the options for configuring seccomp on a swarm-managed
|
||||||
|
// container.
|
||||||
|
type SeccompOpts struct {
|
||||||
|
// Mode is the SeccompMode used for the container.
|
||||||
|
Mode SeccompMode `json:",omitempty"`
|
||||||
|
// Profile is the custom seccomp profile as a json object to be used with
|
||||||
|
// the container. Mode should be set to SeccompModeCustom when using a
|
||||||
|
// custom profile in this manner.
|
||||||
|
Profile []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AppArmorMode is type used for the enumeration of possible AppArmor modes in
|
||||||
|
// AppArmorOpts
|
||||||
|
type AppArmorMode string
|
||||||
|
|
||||||
|
const (
|
||||||
|
AppArmorModeDefault AppArmorMode = "default"
|
||||||
|
AppArmorModeDisabled AppArmorMode = "disabled"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AppArmorOpts defines the options for configuring AppArmor on a swarm-managed
|
||||||
|
// container. Currently, custom AppArmor profiles are not supported.
|
||||||
|
type AppArmorOpts struct {
|
||||||
|
Mode AppArmorMode `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// CredentialSpec for managed service account (Windows only)
|
// CredentialSpec for managed service account (Windows only)
|
||||||
type CredentialSpec struct {
|
type CredentialSpec struct {
|
||||||
Config string
|
Config string
|
||||||
|
@ -43,6 +79,9 @@ type CredentialSpec struct {
|
||||||
type Privileges struct {
|
type Privileges struct {
|
||||||
CredentialSpec *CredentialSpec
|
CredentialSpec *CredentialSpec
|
||||||
SELinuxContext *SELinuxContext
|
SELinuxContext *SELinuxContext
|
||||||
|
Seccomp *SeccompOpts `json:",omitempty"`
|
||||||
|
AppArmor *AppArmorOpts `json:",omitempty"`
|
||||||
|
NoNewPrivileges bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerSpec represents the spec of a container.
|
// ContainerSpec represents the spec of a container.
|
||||||
|
|
20
vendor/github.com/docker/docker/api/types/swarm/service_create_response.go
generated
vendored
Normal file
20
vendor/github.com/docker/docker/api/types/swarm/service_create_response.go
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package swarm
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// ServiceCreateResponse contains the information returned to a client on the
|
||||||
|
// creation of a new service.
|
||||||
|
//
|
||||||
|
// swagger:model ServiceCreateResponse
|
||||||
|
type ServiceCreateResponse struct {
|
||||||
|
|
||||||
|
// The ID of the created service.
|
||||||
|
ID string `json:"ID,omitempty"`
|
||||||
|
|
||||||
|
// Optional warning message.
|
||||||
|
//
|
||||||
|
// FIXME(thaJeztah): this should have "omitempty" in the generated type.
|
||||||
|
//
|
||||||
|
Warnings []string `json:"Warnings"`
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package types
|
package swarm
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/docker/docker/api/types/mount"
|
"github.com/docker/docker/api/types/mount"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
@ -128,13 +129,7 @@ type ImageInspect struct {
|
||||||
// Metadata of the image in the local cache.
|
// Metadata of the image in the local cache.
|
||||||
//
|
//
|
||||||
// This information is local to the daemon, and not part of the image itself.
|
// This information is local to the daemon, and not part of the image itself.
|
||||||
Metadata ImageMetadata
|
Metadata image.Metadata
|
||||||
}
|
|
||||||
|
|
||||||
// ImageMetadata contains engine-local data about the image
|
|
||||||
type ImageMetadata struct {
|
|
||||||
// LastTagTime is the date and time at which the image was last tagged.
|
|
||||||
LastTagTime time.Time `json:",omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container contains response of Engine API:
|
// Container contains response of Engine API:
|
||||||
|
@ -514,7 +509,7 @@ type DiskUsageOptions struct {
|
||||||
// GET "/system/df"
|
// GET "/system/df"
|
||||||
type DiskUsage struct {
|
type DiskUsage struct {
|
||||||
LayersSize int64
|
LayersSize int64
|
||||||
Images []*ImageSummary
|
Images []*image.Summary
|
||||||
Containers []*Container
|
Containers []*Container
|
||||||
Volumes []*volume.Volume
|
Volumes []*volume.Volume
|
||||||
BuildCache []*BuildCache
|
BuildCache []*BuildCache
|
||||||
|
@ -538,7 +533,7 @@ type VolumesPruneReport struct {
|
||||||
// ImagesPruneReport contains the response for Engine API:
|
// ImagesPruneReport contains the response for Engine API:
|
||||||
// POST "/images/prune"
|
// POST "/images/prune"
|
||||||
type ImagesPruneReport struct {
|
type ImagesPruneReport struct {
|
||||||
ImagesDeleted []ImageDeleteResponseItem
|
ImagesDeleted []image.DeleteResponse
|
||||||
SpaceReclaimed uint64
|
SpaceReclaimed uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@ package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/api/types/checkpoint"
|
"github.com/docker/docker/api/types/checkpoint"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/api/types/system"
|
"github.com/docker/docker/api/types/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,6 +66,69 @@ type SecurityOpt = system.SecurityOpt
|
||||||
// Deprecated: use [system.KeyValue].
|
// Deprecated: use [system.KeyValue].
|
||||||
type KeyValue = system.KeyValue
|
type KeyValue = system.KeyValue
|
||||||
|
|
||||||
|
// ImageDeleteResponseItem image delete response item.
|
||||||
|
//
|
||||||
|
// Deprecated: use [image.DeleteResponse].
|
||||||
|
type ImageDeleteResponseItem = image.DeleteResponse
|
||||||
|
|
||||||
|
// ImageSummary image summary.
|
||||||
|
//
|
||||||
|
// Deprecated: use [image.Summary].
|
||||||
|
type ImageSummary = image.Summary
|
||||||
|
|
||||||
|
// ImageMetadata contains engine-local data about the image.
|
||||||
|
//
|
||||||
|
// Deprecated: use [image.Metadata].
|
||||||
|
type ImageMetadata = image.Metadata
|
||||||
|
|
||||||
|
// ServiceCreateResponse contains the information returned to a client
|
||||||
|
// on the creation of a new service.
|
||||||
|
//
|
||||||
|
// Deprecated: use [swarm.ServiceCreateResponse].
|
||||||
|
type ServiceCreateResponse = swarm.ServiceCreateResponse
|
||||||
|
|
||||||
|
// ServiceUpdateResponse service update response.
|
||||||
|
//
|
||||||
|
// Deprecated: use [swarm.ServiceUpdateResponse].
|
||||||
|
type ServiceUpdateResponse = swarm.ServiceUpdateResponse
|
||||||
|
|
||||||
|
// ContainerStartOptions holds parameters to start containers.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.StartOptions].
|
||||||
|
type ContainerStartOptions = container.StartOptions
|
||||||
|
|
||||||
|
// ResizeOptions holds parameters to resize a TTY.
|
||||||
|
// It can be used to resize container TTYs and
|
||||||
|
// exec process TTYs too.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.ResizeOptions].
|
||||||
|
type ResizeOptions = container.ResizeOptions
|
||||||
|
|
||||||
|
// ContainerAttachOptions holds parameters to attach to a container.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.AttachOptions].
|
||||||
|
type ContainerAttachOptions = container.AttachOptions
|
||||||
|
|
||||||
|
// ContainerCommitOptions holds parameters to commit changes into a container.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.CommitOptions].
|
||||||
|
type ContainerCommitOptions = container.CommitOptions
|
||||||
|
|
||||||
|
// ContainerListOptions holds parameters to list containers with.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.ListOptions].
|
||||||
|
type ContainerListOptions = container.ListOptions
|
||||||
|
|
||||||
|
// ContainerLogsOptions holds parameters to filter logs with.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.LogsOptions].
|
||||||
|
type ContainerLogsOptions = container.LogsOptions
|
||||||
|
|
||||||
|
// ContainerRemoveOptions holds parameters to remove containers.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.RemoveOptions].
|
||||||
|
type ContainerRemoveOptions = container.RemoveOptions
|
||||||
|
|
||||||
// DecodeSecurityOptions decodes a security options string slice to a type safe
|
// DecodeSecurityOptions decodes a security options string slice to a type safe
|
||||||
// [system.SecurityOpt].
|
// [system.SecurityOpt].
|
||||||
//
|
//
|
||||||
|
|
|
@ -19,7 +19,7 @@ For example, to list running containers (the equivalent of "docker ps"):
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ For example, to list running containers (the equivalent of "docker ps"):
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
|
containers, err := cli.ContainerList(context.Background(), container.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, container := range containers {
|
for _, ctr := range containers {
|
||||||
fmt.Printf("%s %s\n", container.ID[:10], container.Image)
|
fmt.Printf("%s %s\n", ctr.ID, ctr.Image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerAttach attaches a connection to a container in the server.
|
// ContainerAttach attaches a connection to a container in the server.
|
||||||
|
@ -32,7 +33,7 @@ import (
|
||||||
//
|
//
|
||||||
// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
|
// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
|
||||||
// stream.
|
// stream.
|
||||||
func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) {
|
func (cli *Client) ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if options.Stream {
|
if options.Stream {
|
||||||
query.Set("stream", "1")
|
query.Set("stream", "1")
|
||||||
|
|
|
@ -8,10 +8,11 @@ import (
|
||||||
|
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerCommit applies changes to a container and creates a new tagged image.
|
// ContainerCommit applies changes to a container and creates a new tagged image.
|
||||||
func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
|
func (cli *Client) ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (types.IDResponse, error) {
|
||||||
var repository, tag string
|
var repository, tag string
|
||||||
if options.Reference != "" {
|
if options.Reference != "" {
|
||||||
ref, err := reference.ParseNormalizedNamed(options.Reference)
|
ref, err := reference.ParseNormalizedNamed(options.Reference)
|
||||||
|
|
|
@ -7,11 +7,12 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerList returns the list of containers in the docker host.
|
// ContainerList returns the list of containers in the docker host.
|
||||||
func (cli *Client) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
|
func (cli *Client) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
|
||||||
if options.All {
|
if options.All {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
timetypes "github.com/docker/docker/api/types/time"
|
timetypes "github.com/docker/docker/api/types/time"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -33,7 +33,7 @@ import (
|
||||||
//
|
//
|
||||||
// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
|
// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
|
||||||
// stream.
|
// stream.
|
||||||
func (cli *Client) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
func (cli *Client) ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if options.ShowStdout {
|
if options.ShowStdout {
|
||||||
query.Set("stdout", "1")
|
query.Set("stdout", "1")
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerRemove kills and removes a container from the docker host.
|
// ContainerRemove kills and removes a container from the docker host.
|
||||||
func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error {
|
func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if options.RemoveVolumes {
|
if options.RemoveVolumes {
|
||||||
query.Set("v", "1")
|
query.Set("v", "1")
|
||||||
|
|
|
@ -5,16 +5,16 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerResize changes the size of the tty for a container.
|
// ContainerResize changes the size of the tty for a container.
|
||||||
func (cli *Client) ContainerResize(ctx context.Context, containerID string, options types.ResizeOptions) error {
|
func (cli *Client) ContainerResize(ctx context.Context, containerID string, options container.ResizeOptions) error {
|
||||||
return cli.resize(ctx, "/containers/"+containerID, options.Height, options.Width)
|
return cli.resize(ctx, "/containers/"+containerID, options.Height, options.Width)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerExecResize changes the size of the tty for an exec process running inside a container.
|
// ContainerExecResize changes the size of the tty for an exec process running inside a container.
|
||||||
func (cli *Client) ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error {
|
func (cli *Client) ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error {
|
||||||
return cli.resize(ctx, "/exec/"+execID, options.Height, options.Width)
|
return cli.resize(ctx, "/exec/"+execID, options.Height, options.Width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerStart sends a request to the docker daemon to start a container.
|
// ContainerStart sends a request to the docker daemon to start a container.
|
||||||
func (cli *Client) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error {
|
func (cli *Client) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if len(options.CheckpointID) != 0 {
|
if len(options.CheckpointID) != 0 {
|
||||||
query.Set("checkpoint", options.CheckpointID)
|
query.Set("checkpoint", options.CheckpointID)
|
||||||
|
|
|
@ -7,11 +7,12 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageList returns a list of images in the docker host.
|
// ImageList returns a list of images in the docker host.
|
||||||
func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) {
|
func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) {
|
||||||
// Make sure we negotiated (if the client is configured to do so),
|
// Make sure we negotiated (if the client is configured to do so),
|
||||||
// as code below contains API-version specific handling of options.
|
// as code below contains API-version specific handling of options.
|
||||||
//
|
//
|
||||||
|
@ -19,7 +20,7 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions
|
||||||
// the API request is made.
|
// the API request is made.
|
||||||
cli.checkVersion(ctx)
|
cli.checkVersion(ctx)
|
||||||
|
|
||||||
var images []types.ImageSummary
|
var images []image.Summary
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
|
||||||
optionFilters := options.Filters
|
optionFilters := options.Filters
|
||||||
|
|
|
@ -6,10 +6,11 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageRemove removes an image from the docker host.
|
// ImageRemove removes an image from the docker host.
|
||||||
func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
|
||||||
if options.Force {
|
if options.Force {
|
||||||
|
@ -19,7 +20,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type
|
||||||
query.Set("noprune", "1")
|
query.Set("noprune", "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
var dels []types.ImageDeleteResponseItem
|
var dels []image.DeleteResponse
|
||||||
resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
|
resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -46,30 +46,30 @@ type CommonAPIClient interface {
|
||||||
|
|
||||||
// ContainerAPIClient defines API client methods for the containers
|
// ContainerAPIClient defines API client methods for the containers
|
||||||
type ContainerAPIClient interface {
|
type ContainerAPIClient interface {
|
||||||
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
|
ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error)
|
||||||
ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
|
ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (types.IDResponse, error)
|
||||||
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
|
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
|
||||||
ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
|
ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
|
||||||
ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
|
ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
|
||||||
ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
|
ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
|
||||||
ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
|
ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
|
||||||
ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error
|
ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error
|
||||||
ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
|
ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
|
||||||
ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
|
ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
|
||||||
ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
|
ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
|
||||||
ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
|
ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
|
||||||
ContainerKill(ctx context.Context, container, signal string) error
|
ContainerKill(ctx context.Context, container, signal string) error
|
||||||
ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
|
ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
|
||||||
ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
|
ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error)
|
||||||
ContainerPause(ctx context.Context, container string) error
|
ContainerPause(ctx context.Context, container string) error
|
||||||
ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
|
ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error
|
||||||
ContainerRename(ctx context.Context, container, newContainerName string) error
|
ContainerRename(ctx context.Context, container, newContainerName string) error
|
||||||
ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
|
ContainerResize(ctx context.Context, container string, options container.ResizeOptions) error
|
||||||
ContainerRestart(ctx context.Context, container string, options container.StopOptions) error
|
ContainerRestart(ctx context.Context, container string, options container.StopOptions) error
|
||||||
ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
|
ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
|
||||||
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
||||||
ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error)
|
ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error)
|
||||||
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
|
ContainerStart(ctx context.Context, container string, options container.StartOptions) error
|
||||||
ContainerStop(ctx context.Context, container string, options container.StopOptions) error
|
ContainerStop(ctx context.Context, container string, options container.StopOptions) error
|
||||||
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
||||||
ContainerUnpause(ctx context.Context, container string) error
|
ContainerUnpause(ctx context.Context, container string) error
|
||||||
|
@ -94,11 +94,11 @@ type ImageAPIClient interface {
|
||||||
ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
|
ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
|
||||||
ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
|
ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
|
||||||
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
|
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
|
||||||
ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
|
ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error)
|
||||||
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
|
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
|
||||||
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
|
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
|
||||||
ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
|
ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
|
||||||
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
|
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error)
|
||||||
ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
|
ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
|
||||||
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
|
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
|
||||||
ImageTag(ctx context.Context, image, ref string) error
|
ImageTag(ctx context.Context, image, ref string) error
|
||||||
|
@ -141,13 +141,13 @@ type PluginAPIClient interface {
|
||||||
|
|
||||||
// ServiceAPIClient defines API client methods for the services
|
// ServiceAPIClient defines API client methods for the services
|
||||||
type ServiceAPIClient interface {
|
type ServiceAPIClient interface {
|
||||||
ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
|
ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error)
|
||||||
ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
|
||||||
ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
|
ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
|
||||||
ServiceRemove(ctx context.Context, serviceID string) error
|
ServiceRemove(ctx context.Context, serviceID string) error
|
||||||
ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
|
ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
|
||||||
ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
|
ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error)
|
||||||
TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
|
TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error)
|
||||||
TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
|
TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
|
||||||
TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
|
TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceCreate creates a new service.
|
// ServiceCreate creates a new service.
|
||||||
func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) {
|
func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) {
|
||||||
var response types.ServiceCreateResponse
|
var response swarm.ServiceCreateResponse
|
||||||
|
|
||||||
// Make sure we negotiated (if the client is configured to do so),
|
// Make sure we negotiated (if the client is configured to do so),
|
||||||
// as code below contains API-version specific handling of options.
|
// as code below contains API-version specific handling of options.
|
||||||
|
|
|
@ -6,14 +6,14 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
timetypes "github.com/docker/docker/api/types/time"
|
timetypes "github.com/docker/docker/api/types/time"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceLogs returns the logs generated by a service in an io.ReadCloser.
|
// ServiceLogs returns the logs generated by a service in an io.ReadCloser.
|
||||||
// It's up to the caller to close the stream.
|
// It's up to the caller to close the stream.
|
||||||
func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if options.ShowStdout {
|
if options.ShowStdout {
|
||||||
query.Set("stdout", "1")
|
query.Set("stdout", "1")
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// ServiceUpdate updates a Service. The version number is required to avoid conflicting writes.
|
// ServiceUpdate updates a Service. The version number is required to avoid conflicting writes.
|
||||||
// It should be the value as set *before* the update. You can find this value in the Meta field
|
// It should be the value as set *before* the update. You can find this value in the Meta field
|
||||||
// of swarm.Service, which can be found using ServiceInspectWithRaw.
|
// of swarm.Service, which can be found using ServiceInspectWithRaw.
|
||||||
func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
|
func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
|
||||||
// Make sure we negotiated (if the client is configured to do so),
|
// Make sure we negotiated (if the client is configured to do so),
|
||||||
// as code below contains API-version specific handling of options.
|
// as code below contains API-version specific handling of options.
|
||||||
//
|
//
|
||||||
|
@ -25,7 +25,7 @@ func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version
|
||||||
|
|
||||||
var (
|
var (
|
||||||
query = url.Values{}
|
query = url.Values{}
|
||||||
response = types.ServiceUpdateResponse{}
|
response = swarm.ServiceUpdateResponse{}
|
||||||
)
|
)
|
||||||
|
|
||||||
if options.RegistryAuthFrom != "" {
|
if options.RegistryAuthFrom != "" {
|
||||||
|
|
|
@ -6,13 +6,13 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
timetypes "github.com/docker/docker/api/types/time"
|
timetypes "github.com/docker/docker/api/types/time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TaskLogs returns the logs generated by a task in an io.ReadCloser.
|
// TaskLogs returns the logs generated by a task in an io.ReadCloser.
|
||||||
// It's up to the caller to close the stream.
|
// It's up to the caller to close the stream.
|
||||||
func (cli *Client) TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
func (cli *Client) TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if options.ShowStdout {
|
if options.ShowStdout {
|
||||||
query.Set("stdout", "1")
|
query.Set("stdout", "1")
|
||||||
|
|
|
@ -20,8 +20,8 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
|
||||||
"github.com/containerd/containerd/pkg/userns"
|
"github.com/containerd/containerd/pkg/userns"
|
||||||
|
"github.com/containerd/log"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
"github.com/docker/docker/pkg/pools"
|
"github.com/docker/docker/pkg/pools"
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/pools"
|
"github.com/docker/docker/pkg/pools"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/docker/pkg/pools"
|
"github.com/docker/docker/pkg/pools"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/distribution/registry/client/auth"
|
"github.com/docker/distribution/registry/client/auth"
|
||||||
"github.com/docker/distribution/registry/client/auth/challenge"
|
"github.com/docker/distribution/registry/client/auth/challenge"
|
||||||
"github.com/docker/distribution/registry/client/transport"
|
"github.com/docker/distribution/registry/client/transport"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
)
|
)
|
||||||
|
@ -330,8 +330,8 @@ func ValidateMirror(val string) (string, error) {
|
||||||
if uri.Scheme != "http" && uri.Scheme != "https" {
|
if uri.Scheme != "http" && uri.Scheme != "https" {
|
||||||
return "", invalidParamf("invalid mirror: unsupported scheme %q in %q", uri.Scheme, uri)
|
return "", invalidParamf("invalid mirror: unsupported scheme %q in %q", uri.Scheme, uri)
|
||||||
}
|
}
|
||||||
if (uri.Path != "" && uri.Path != "/") || uri.RawQuery != "" || uri.Fragment != "" {
|
if uri.RawQuery != "" || uri.Fragment != "" {
|
||||||
return "", invalidParamf("invalid mirror: path, query, or fragment at end of the URI %q", uri)
|
return "", invalidParamf("invalid mirror: query or fragment at end of the URI %q", uri)
|
||||||
}
|
}
|
||||||
if uri.User != nil {
|
if uri.User != nil {
|
||||||
// strip password from output
|
// strip password from output
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/distribution/registry/client/transport"
|
"github.com/docker/distribution/registry/client/transport"
|
||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/docker/go-connections/tlsconfig"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/distribution/registry/client/auth"
|
"github.com/docker/distribution/registry/client/auth"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/distribution/registry/client/transport"
|
"github.com/docker/distribution/registry/client/transport"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
|
|
|
@ -56,7 +56,7 @@ github.com/docker/distribution/registry/client/transport
|
||||||
github.com/docker/distribution/registry/storage/cache
|
github.com/docker/distribution/registry/storage/cache
|
||||||
github.com/docker/distribution/registry/storage/cache/memory
|
github.com/docker/distribution/registry/storage/cache/memory
|
||||||
github.com/docker/distribution/uuid
|
github.com/docker/distribution/uuid
|
||||||
# github.com/docker/docker v24.0.0-rc.2.0.20230921123131-d3afa80b96bf+incompatible
|
# github.com/docker/docker v24.0.0-rc.2.0.20231013183648-cdb3f9fb8dca+incompatible
|
||||||
## explicit
|
## explicit
|
||||||
github.com/docker/docker/api
|
github.com/docker/docker/api
|
||||||
github.com/docker/docker/api/types
|
github.com/docker/docker/api/types
|
||||||
|
|
Loading…
Reference in New Issue