docker_driver

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

Copyright 2020 PhysarumSM Development Team * * 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 BuildImage

func BuildImage(buildContext io.Reader, image string) error

Builds an image given a build context and image name buildContext is a tar archive containing all files needed to build image, including Dockerfile

func CheckContainerHealth

func CheckContainerHealth(cont string) (float64, float64, error)

calculate container cpu and mem usage

func CreateEncodedAuth

func CreateEncodedAuth(username, password string) (string, error)

Creates a base64-encoded registry auth configuration Used when pushing an image Supply this function's output as an argument to PushImage() More info: https://docs.docker.com/engine/api/v1.40/#section/Authentication

func DeleteContainer

func DeleteContainer(cont string) (string, error)

deleting container

func ListImages

func ListImages() ([]string, error)

func ListRunningContainers

func ListRunningContainers() ([]string, error)

func PullImage

func PullImage(image string) (digest string, err error)

Pull image and return image digest

func PushImage

func PushImage(encodedAuth, image string) (digest string, err error)

Push an image Returns its calculated digest (SHA256 hash of the image)

func ResizeContainer

func ResizeContainer(cont string, mem int64, cpu float64) (string, error)

resizing a container instance on the fly

func RestartContainer

func RestartContainer(cont string) (string, error)

restarting container

func RunContainer

func RunContainer(opt DockerConfig) (string, error)

create and run container - interactive and detached set image (already pulled) should be imagename:version default/empty cmd is /bin/bash

func SaveImage

func SaveImage(image string) ([]byte, error)

Save an image into a tar archive format Returns the tar archive in byte slice

func StopContainer

func StopContainer(cont string) (string, error)

stopping container

Types

type DockerConfig

type DockerConfig struct {
	Name    string
	Image   string
	Port    [2]string
	Cmd     []string
	Memory  int64   // in bytes   min is 4M   default is inf
	Cpu     float64 // between 0.00 to 1.00*cores
	Network string
	Env     []string
}

Jump to

Keyboard shortcuts

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