|
@@ -87,12 +87,27 @@ func NewDryRunClient(apiClient client.APIClient, cli *command.DockerCli) (*DryRu
|
|
|
// All methods and functions which need to be overridden for dry run.
|
|
// All methods and functions which need to be overridden for dry run.
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerAttach(ctx context.Context, container string, options moby.ContainerAttachOptions) (moby.HijackedResponse, error) {
|
|
func (d *DryRunClient) ContainerAttach(ctx context.Context, container string, options moby.ContainerAttachOptions) (moby.HijackedResponse, error) {
|
|
|
- return moby.HijackedResponse{}, ErrNotImplemented
|
|
|
|
|
|
|
+ return moby.HijackedResponse{}, errors.New("interactive run is not supported in dry-run mode")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerCreate(ctx context.Context, config *containerType.Config, hostConfig *containerType.HostConfig,
|
|
func (d *DryRunClient) ContainerCreate(ctx context.Context, config *containerType.Config, hostConfig *containerType.HostConfig,
|
|
|
networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (containerType.CreateResponse, error) {
|
|
networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (containerType.CreateResponse, error) {
|
|
|
- return containerType.CreateResponse{}, ErrNotImplemented
|
|
|
|
|
|
|
+ return containerType.CreateResponse{ID: "dryRunId"}, nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (d *DryRunClient) ContainerInspect(ctx context.Context, container string) (moby.ContainerJSON, error) {
|
|
|
|
|
+ containerJSON, err := d.apiClient.ContainerInspect(ctx, container)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return moby.ContainerJSON{
|
|
|
|
|
+ ContainerJSONBase: &moby.ContainerJSONBase{
|
|
|
|
|
+ ID: "dryRunId",
|
|
|
|
|
+ },
|
|
|
|
|
+ Mounts: nil,
|
|
|
|
|
+ Config: &containerType.Config{},
|
|
|
|
|
+ NetworkSettings: &moby.NetworkSettings{},
|
|
|
|
|
+ }, nil
|
|
|
|
|
+ }
|
|
|
|
|
+ return containerJSON, err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerKill(ctx context.Context, container, signal string) error {
|
|
func (d *DryRunClient) ContainerKill(ctx context.Context, container, signal string) error {
|
|
@@ -108,7 +123,7 @@ func (d *DryRunClient) ContainerRemove(ctx context.Context, container string, op
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerRename(ctx context.Context, container, newContainerName string) error {
|
|
func (d *DryRunClient) ContainerRename(ctx context.Context, container, newContainerName string) error {
|
|
|
- return ErrNotImplemented
|
|
|
|
|
|
|
+ return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerRestart(ctx context.Context, container string, options containerType.StopOptions) error {
|
|
func (d *DryRunClient) ContainerRestart(ctx context.Context, container string, options containerType.StopOptions) error {
|
|
@@ -116,7 +131,7 @@ func (d *DryRunClient) ContainerRestart(ctx context.Context, container string, o
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerStart(ctx context.Context, container string, options moby.ContainerStartOptions) error {
|
|
func (d *DryRunClient) ContainerStart(ctx context.Context, container string, options moby.ContainerStartOptions) error {
|
|
|
- return ErrNotImplemented
|
|
|
|
|
|
|
+ return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) ContainerStop(ctx context.Context, container string, options containerType.StopOptions) error {
|
|
func (d *DryRunClient) ContainerStop(ctx context.Context, container string, options containerType.StopOptions) error {
|
|
@@ -185,7 +200,7 @@ func (d *DryRunClient) ImageRemove(ctx context.Context, imageName string, option
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) NetworkConnect(ctx context.Context, networkName, container string, config *network.EndpointSettings) error {
|
|
func (d *DryRunClient) NetworkConnect(ctx context.Context, networkName, container string, config *network.EndpointSettings) error {
|
|
|
- return ErrNotImplemented
|
|
|
|
|
|
|
+ return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) NetworkCreate(ctx context.Context, name string, options moby.NetworkCreate) (moby.NetworkCreateResponse, error) {
|
|
func (d *DryRunClient) NetworkCreate(ctx context.Context, name string, options moby.NetworkCreate) (moby.NetworkCreateResponse, error) {
|
|
@@ -193,7 +208,7 @@ func (d *DryRunClient) NetworkCreate(ctx context.Context, name string, options m
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) NetworkDisconnect(ctx context.Context, networkName, container string, force bool) error {
|
|
func (d *DryRunClient) NetworkDisconnect(ctx context.Context, networkName, container string, force bool) error {
|
|
|
- return ErrNotImplemented
|
|
|
|
|
|
|
+ return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *DryRunClient) NetworkRemove(ctx context.Context, networkName string) error {
|
|
func (d *DryRunClient) NetworkRemove(ctx context.Context, networkName string) error {
|
|
@@ -275,10 +290,6 @@ func (d *DryRunClient) ContainerExport(ctx context.Context, container string) (i
|
|
|
return d.apiClient.ContainerExport(ctx, container)
|
|
return d.apiClient.ContainerExport(ctx, container)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (d *DryRunClient) ContainerInspect(ctx context.Context, container string) (moby.ContainerJSON, error) {
|
|
|
|
|
- return d.apiClient.ContainerInspect(ctx, container)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (d *DryRunClient) ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (moby.ContainerJSON, []byte, error) {
|
|
func (d *DryRunClient) ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (moby.ContainerJSON, []byte, error) {
|
|
|
return d.apiClient.ContainerInspectWithRaw(ctx, container, getSize)
|
|
return d.apiClient.ContainerInspectWithRaw(ctx, container, getSize)
|
|
|
}
|
|
}
|