docker

package
v0.14.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Overview

Parse a dockerfile into a high-level representation using the official go parser

Index

Constants

View Source
const (
	// Docker is the docker command.
	Docker = "docker"
)

Variables

This section is empty.

Functions

func AirflowCommand added in v0.8.0

func AirflowCommand(id string, airflowCommand string) string

AirflowCommand is the main method of interaction with Airflow

func AllCmds added in v0.11.0

func AllCmds() []string

List all legal cmds in a dockerfile

func Exec

func Exec(args ...string) error

Exec executes a docker command

func ExecLogin added in v0.0.5

func ExecLogin(serverAddress, username, token string) error

ExecLogin executes a docker login similar to docker login command

func ExecPush added in v0.9.1

func ExecPush(serverAddress, token, image string) error

ExecPush does push image to registry using native docker client, instead of using `docker push` in bash

func GetImageTagFromParsedFile added in v0.11.0

func GetImageTagFromParsedFile(cmds []Command) (baseImage, tag string)

Parse tag from parsed dockerfile: e.g. FROM ubuntu:xenial returns "ubuntu", "xenial"

Types

type Command added in v0.11.0

type Command struct {
	Cmd       string   // lower cased command name (ex: `from`)
	SubCmd    string   // for ONBUILD only this holds the sub-command
	Json      bool     // whether the value is written in json form
	Original  string   // The original source line
	StartLine int      // The original source line number which starts this command
	EndLine   int      // The original source line number which ends this command
	Flags     []string // Any flags such as `--from=...` for `COPY`.
	Value     []string // The contents of the command (ex: `ubuntu:xenial`)
}

Represents a single line (layer) in a Dockerfile. For example `FROM ubuntu:xenial`

func ParseFile added in v0.11.0

func ParseFile(filename string) ([]Command, error)

Parse a Dockerfile from a filename. An IOError or ParseError may occur.

func ParseReader added in v0.11.0

func ParseReader(file io.Reader) ([]Command, error)

Parse a Dockerfile from a reader. A ParseError may occur.

type IOError added in v0.11.0

type IOError struct {
	Msg string
}

A failure in opening a file for reading.

func (IOError) Error added in v0.11.0

func (e IOError) Error() string

type ParseError added in v0.11.0

type ParseError struct {
	Msg string
}

A failure in parsing the file as a dockerfile.

func (ParseError) Error added in v0.11.0

func (e ParseError) Error() string

Jump to

Keyboard shortcuts

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