docker

package
v0.0.0-...-68b20d9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • 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

func New

func New(dic *di.Container, ctx context.Context, wg *sync.WaitGroup, dcm dtos.DriverConfigManage) (*dockerImpl, error)

Types

type ContainerInfo

type ContainerInfo struct {
	Id    string
	Name  string
	State string
}

容器信息

type CustomParams

type CustomParams struct {
	// contains filtered or unexported fields
}

type DockerManager

type DockerManager struct {
	// 镜像repoTags:imageinfo
	ImageMap map[string]ImageInfo
	// 容器name:ContainerInfo
	ContainerMap map[string]ContainerInfo
	// contains filtered or unexported fields
}

func NewDockerManager

func NewDockerManager(ctx context.Context, dic *di.Container, dcm *dtos.DriverConfigManage) (*DockerManager, error)

NewDockerManager 创建

func (*DockerManager) ContainerIsExist

func (dm *DockerManager) ContainerIsExist(containerIdOrName string) bool

func (*DockerManager) ContainerRemove

func (dm *DockerManager) ContainerRemove(containerIdOrName string) error

默认为容器强制删除

func (*DockerManager) ContainerRename

func (dm *DockerManager) ContainerRename(originNameOrId string, nowName string) bool

func (*DockerManager) ContainerStart

func (dm *DockerManager) ContainerStart(imageRepo string, containerName string, runConfigPath string, mountDevices []string, customParams string, instanceType constants.InstanceType) (ip string, err error)

启动容器,这里为强制重启 先删除容器在启动新容器 containerId 可为空

func (*DockerManager) ContainerStop

func (dm *DockerManager) ContainerStop(containerIdOrName string) error

func (*DockerManager) ExistImageById

func (dm *DockerManager) ExistImageById(imageId string) bool

获取镜像id是否存在

func (*DockerManager) FlushAuthToken deprecated

func (dm *DockerManager) FlushAuthToken(username string, password string, serverAddress string)

Deprecated: docker api 的flush接口返回的值无效

func (*DockerManager) GetAllImagesIds

func (dm *DockerManager) GetAllImagesIds() []string

func (*DockerManager) GetAuthToken

func (dm *DockerManager) GetAuthToken(username string, password string, serverAddress string) string

func (*DockerManager) GetContainerInspect

func (dm *DockerManager) GetContainerInspect(containerName string) (types.ContainerJSON, error)

func (*DockerManager) GetContainerIp

func (dm *DockerManager) GetContainerIp(containerId string) (ip string, err error)

func (*DockerManager) GetContainerList

func (dm *DockerManager) GetContainerList() (containers []types.Container, err error)

func (*DockerManager) GetContainerMountDevices

func (dm *DockerManager) GetContainerMountDevices(containerId string) []string

获取容器挂载设备的信息,返回挂载设备路径slice ["/dev/ttyUSB0","/dev/ttyUSB0"]

func (*DockerManager) GetContainerRunStatus

func (dm *DockerManager) GetContainerRunStatus(containerName string) (status string, err error)

获取容器运行状态, 目前不做任何错误处理

func (*DockerManager) GetImageList

func (dm *DockerManager) GetImageList() ([]types.ImageSummary, error)

func (*DockerManager) ImageRemove

func (dm *DockerManager) ImageRemove(imageId string) error

func (*DockerManager) ParseCustomParams

func (dm *DockerManager) ParseCustomParams(cmd string) (CustomParams, error)

自定义docker启动参数解析

func (*DockerManager) PullDockerImage

func (dm *DockerManager) PullDockerImage(imageUrl string, authToken string) (string, error)

type ImageInfo

type ImageInfo struct {
	Id       string
	RepoTags []string
}

镜像信息

Jump to

Keyboard shortcuts

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