socker

package
v0.0.0-...-2540391 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package socker implements a secure runner for docker containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseImages

func ParseImages(repoFilter, filter string) (map[string]Image, error)

ParseImages parses images from docker.

func QueryChildPIDs

func QueryChildPIDs(parentID string) ([]string, error)

QueryChildPIDs lookups child process ids of specified parent process.

Types

type Config

type Config struct {
	Verbose       bool
	EpilogEnabled bool
	Insecure      bool
}

Config represents the socker configurations.

type ExecOpts

type ExecOpts struct {
	TTY         bool   `short:"t" long:"tty"`
	Interactive bool   `short:"i" long:"interactive"`
	Detach      bool   `short:"d" long:"detach"`
	User        string `short:"u" long:"user"`
}

ExecOpts represents the socker supported docker exec options.

type Image

type Image struct {
	ID            string `yaml:"id"`
	Desc          string `yaml:"desc"`
	Repository    string `yaml:"repository"`
	Tag           string `yaml:"tag"`
	CreatedScince string `yaml:"created_since"`
	CreatedAt     string `yaml:"created_at"`
	Size          string `yaml:"size"`
}

Image represents the socker/socker availible image format

type Opts

type Opts struct {
	Volumes     []string `short:"v" long:"volume"`
	TTY         bool     `short:"t" long:"tty"`
	Interactive bool     `short:"i" long:"interactive"`
	Detach      bool     `short:"d" long:"detach"`
	Runtime     string   `long:"runtime"`
	Network     string   `long:"network"`
	Name        string   `long:"name"`
	Hostname    string   `short:"h" long:"hostname"`
	User        string   `short:"u" long:"user"`
	StorageOpt  string   `long:"storage-opt"`
	ShmSize     string   `long:"shm-size"`
}

Opts represents the socker supported docker options.

type Socker

type Socker struct {
	CurrentUID string

	*Config
	// contains filtered or unexported fields
}

Socker provides a runner for docker.

func New

func New(conf *Config) (*Socker, error)

New creates a socker instance.

func (*Socker) Exec

func (s *Socker) Exec(command []string) error

Exec runs a command in a running container as regular user.

func (*Socker) FormatImages

func (s *Socker) FormatImages(config string) (map[string]Image, error)

FormatImages lists all available images from registry by map.

func (*Socker) PrintImages

func (s *Socker) PrintImages(config string) error

PrintImages prints available images for CLI.

func (*Socker) RunImage

func (s *Socker) RunImage(command []string) error

RunImage runs container.

func (*Socker) SyncImages

func (s *Socker) SyncImages(configFile, repoFilter, filter string) error

SyncImages syncs available images for CLI.

Jump to

Keyboard shortcuts

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