docker

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

* Copyright 1999-2020 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 1999-2020 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Ctx context.Context
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string) (*Client, error)

GetClient returns the docker client

func (*Client) CopyToContainer

func (c *Client) CopyToContainer(ctx context.Context, containerId, srcFile, dstPath, extractDirName string, override bool) error

CopyToContainer copies a tar file to the dstPath. If the same file exits in the dstPath, it will be override if the override arg is true, otherwise not

func (*Client) ExecContainer

func (c *Client) ExecContainer(ctx context.Context, containerId, command string) (output string, err error)

func (*Client) ExecuteAndRemove

func (c *Client) ExecuteAndRemove(ctx context.Context, config *containertype.Config, hostConfig *containertype.HostConfig,
	networkConfig *network.NetworkingConfig, containerName string, removed bool,
	timeout time.Duration,
	command string, containerInfo container.ContainerInfo) (containerId string, output string, err error, code int32)

ExecuteAndRemove: create and start a container for executing a command, and remove the container

func (*Client) GetContainerById

func (c *Client) GetContainerById(ctx context.Context, containerId string) (container.ContainerInfo, error, int32)

func (*Client) GetContainerByLabelSelector

func (c *Client) GetContainerByLabelSelector(labels map[string]string) (container.ContainerInfo, error, int32)

func (*Client) GetContainerByName

func (c *Client) GetContainerByName(ctx context.Context, containerName string) (container.ContainerInfo, error, int32)

getContainerByName returns the container object by container name

func (*Client) GetContainerFromDocker

func (c *Client) GetContainerFromDocker(option types.ContainerListOptions) (container.ContainerInfo, error, int32)

func (*Client) GetPidById

func (c *Client) GetPidById(ctx context.Context, containerId string) (int32, error, int32)

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(ctx context.Context, containerId string, force bool) error

RemoveContainer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL