Categorygithub.com/concourse/garden
modulepackage
0.0.0-20170301120923-99c2af8cdd15
Repository: https://github.com/concourse/garden.git
Documentation: pkg.go.dev

# README

                                                 ,-.
                                                  ) \
                                              .--'   |
                                             /       /
                                             |_______|
                                            (  O   O  )
                                             {'-(_)-'}
                                           .-{   ^   }-.
                                          /   '.___.'   \
                                         /  |    o    |  \
                                         |__|    o    |__|
                                         (((\_________/)))
                                             \___|___/
                                        jgs.--' | | '--.
                                           \__._| |_.__/

Note: This repository should be imported as code.cloudfoundry.org/garden.

A rich golang client and server for container creation and management with pluggable backends for The Open Container Initiative Spec and windows.

Garden is a platform-agnostic Go API for container creation and management, with pluggable backends for different platforms and runtimes. This package contains the canonical client, as well as a server package containing an interface to be implemented by backends.

If you're just getting started, you probably want to begin by setting up one of the backends listed below. If you want to use the Garden client to manage containers, see the Client API section.

Backends

Backends implement support for various specific platforms. So far, the list of backends is as follows:

Client API

The canonical API for Garden is defined as a collection of Go interfaces. See the godoc documentation for details.

Example use

Install needed packages:

go get code.cloudfoundry.org/garden
go get code.cloudfoundry.org/lager

Import these packages:

"bytes"
"fmt"

"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/garden/client"
"code.cloudfoundry.org/garden/client/connection"

Create a client:

gardenClient := client.New(connection.New("tcp", "127.0.0.1:7777"))

Create a container:

container, err := gdnClient.Create(garden.ContainerSpec{})
if err != nil {
  os.Exit(1)
}

Run a process:

buffer := &bytes.Buffer{}
process, err := container.Run(garden.ProcessSpec{
  Path: "echo",
  Args: []string{"hello from the container"},
}, garden.ProcessIO{
  Stdout: buffer,
  Stderr: buffer,
})
if err != nil {
  os.Exit(1)
}

exitCode, err := process.Wait()
if err != nil {
  os.Exit(1)
}

fmt.Printf("Exit code: %d, Process output %s", exitCode, buffer.String())

Development

Prerequisites

  • go
  • git (for garden and its dependencies)
  • mercurial (for some other dependencies not using git)

Running the tests

Assuming go is installed and $GOPATH is set:

mkdir -p $GOPATH/src/code.cloudfoundry.org
cd $GOPATH/src/code.cloudfoundry.org
git clone [email protected]:cloudfoundry/garden
cd garden
go get -t -u ./...
go install github.com/onsi/ginkgo/ginkgo
ginkgo -r

# Packages

No description provided by the author
This file was generated by counterfeiter.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

ICMPControlCode creates a value for the Code field in ICMPControl.
IPRangeFromIP creates an IPRange containing a single IP.
IPRangeFromIPNet creates an IPRange containing the same IPs as a given IPNet.
No description provided by the author
No description provided by the author
No description provided by the author
PortRangeFromPort creates a PortRange containing a single port.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
BindMount specifies parameters for a single mount point.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ContainerInfo holds information about a container.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ContainerSpec specifies the parameters for creating a container.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ProcessSpec contains parameters for running a script inside a container.
Resource limits.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
go:generate counterfeiter .
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author