container

package
v0.0.0-...-1d6cbaf Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

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

View Source
const (
	ContainerdRuntime = "containerd"
	DockerRuntime     = "docker"
)
View Source
const (
	ChaosBladeImageVersion = "latest"
	DefaultImageRepo       = "registry.cn-hangzhou.aliyuncs.com/chaosblade/chaosblade-tool"
)

Variables

This section is empty.

Functions

func CopyToContainer

func CopyToContainer(ctx context.Context, pid uint32, srcFile, dstPath, extractDirName string, override bool) error

func ExecContainer

func ExecContainer(ctx context.Context, pid int32, command string) (output string, err error)

func GetChaosBladeImageRef

func GetChaosBladeImageRef(repo, version string) string

Types

type Container

type Container interface {
	GetPidById(ctx context.Context, containerId string) (int32, error, int32)
	GetContainerById(ctx context.Context, containerId string) (ContainerInfo, error, int32)
	GetContainerByName(ctx context.Context, containerName string) (ContainerInfo, error, int32)
	GetContainerByLabelSelector(containerLabelSelector map[string]string) (ContainerInfo, error, int32)
	RemoveContainer(ctx context.Context, containerId string, force bool) error
	CopyToContainer(ctx context.Context, containerId, srcFile, dstPath, extractDirName string, override bool) error

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

type ContainerInfo

type ContainerInfo struct {
	ContainerId   string
	ContainerName string
	Labels        map[string]string
	Spec          *types.Any
}

ContainerInfo for server

Directories

Path Synopsis
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2020 Alibaba Group Holding Ltd.

Jump to

Keyboard shortcuts

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