by cloudfoundry

cloudfoundry / garden
206 Stars 48 Forks Last release: Not found Apache License 2.0 1.1K Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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

Note: This repository should be imported as

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 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
go get

Import these packages: ``` "bytes" "fmt" "os"

"" "" "" ```

Create a client:

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

Create a container:

container, err := gardenClient.Create(garden.ContainerSpec{})
if err != nil {

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()) ```



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

Running the tests

Assuming go is installed and

is set:
mkdir -p $GOPATH/src/
cd $GOPATH/src/
git clone [email protected]:cloudfoundry/garden
cd garden
go get -t -u ./...
go install
ginkgo -r

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.