docker

package
v0.0.0-...-740721f Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bench []Image = []Image{
	Ubuntu("bionic"),
	CentOS(7),
}

Bench is

View Source
var FullBench []Image = []Image{

	Debian("bullseye"),
	Debian("buster"),
	Debian("stretch"),

	Ubuntu("bionic"),
	Ubuntu("eoan"),
	Ubuntu("focal"),
	Ubuntu("trusty"),
	Ubuntu("xenial"),

	CentOS(7),
	CentOS(6),

	RedHat(6),
	RedHat(7),

	Oracle(6),
	Oracle(7),
	Oracle(8),

	Fedora(26),
	Fedora(27),
	Fedora(28),
	Fedora(29),
	Fedora(30),
	Fedora(31),
	Fedora(32),
	Fedora(33),
}

FullBench is a map of images that can be used as a test bench.

Functions

This section is empty.

Types

type Container

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

Container represents a docker container

func New

func New(image Image) (*Container, error)

New creates runs a docker container with ssh enabled.

func (*Container) Addr

func (c *Container) Addr() string

Addr is a handy function for getting the container address string localhost:port

func (*Container) Exec

func (c *Container) Exec(cmd string) (string, string, int, error)

Exec issues 'docker exec' to the container. Returns stdout, stderr and exitcode if found. Leading and trailing spaces and newlines are trimmed from stdout and stderr.

func (*Container) Image

func (c *Container) Image() string

Image returns the image name

func (*Container) Kill

func (c *Container) Kill() error

Kill issues 'docker kill' on the container

func (*Container) NewSSHClient

func (c *Container) NewSSHClient(user string) (*ssh.Client, error)

NewSSHClient returns a new ssh client for the container user must be eiter root, gossh or hobgob

func (*Container) Port

func (c *Container) Port() int

Port gets the port that SSH is listening on

type Image

type Image struct {
	// From and tag is the docker image (prefixed repo url, if not hub.docker.com)
	//
	// Used in the from statement in the top of the Dockerfile
	//
	// FROM <From>[:<tag>]
	From string
	Tag  string

	// Last part of the dockerfile, after FROM
	Instructions string

	// Slug should be a short sluglike name
	Slug string
}

Image is a reference to a docker image

func CentOS

func CentOS(version int) Image

CentOS returns a CentOS image

func Debian

func Debian(tag string) Image

Debian returns a Debian image

https://hub.docker.com/_/debian

func Fedora

func Fedora(version int) Image

Fedora returns a fedora image

func Oracle

func Oracle(version int) Image

Oracle returns a ol Image

func RedHat

func RedHat(version int) Image

RedHat returns a RHEL image

func Ubuntu

func Ubuntu(tag string) Image

Ubuntu returns a ubuntu image

func (Image) Dockerfile

func (i Image) Dockerfile() string

Dockerfile returns the dockerfile for a debian image

func (Image) Name

func (i Image) Name() string

Name returns a gossh-prefixed name for the image

Jump to

Keyboard shortcuts

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