Name: libcompose
Owner: Docker
Description: An experimental go library providing Compose-like functionality
Created: 2015-05-20 19:22:20.0
Updated: 2018-05-21 09:08:44.0
Pushed: 2018-04-23 13:05:45.0
Homepage: https://godoc.org/github.com/docker/libcompose
Size: 5212
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A Go library for Docker Compose. It does everything the command-line tool does, but from within Go – read Compose files, start them, scale them, etc.
Note: This is experimental and not intended to replace the Docker Compose command-line tool. If you're looking to use Compose, head over to the Compose installation instructions to get started with it.
Here is a list of known project that uses libcompose
:
age main
rt (
"log"
"golang.org/x/net/context"
"github.com/docker/libcompose/docker"
"github.com/docker/libcompose/docker/ctx"
"github.com/docker/libcompose/project"
"github.com/docker/libcompose/project/options"
main() {
project, err := docker.NewProject(&ctx.Context{
Context: project.Context{
ComposeFiles: []string{"docker-compose.yml"},
ProjectName: "my-compose",
},
}, nil)
if err != nil {
log.Fatal(err)
}
err = project.Up(context.Background(), options.Up{})
if err != nil {
log.Fatal(err)
}
You need either Docker and make
,
or go
in order to build libcompose.
docker
You need Docker and make
and then run the binary
target. This
will create binary for all platform in the bundles
folder.
ke binary
er build -t "libcompose-dev:refactor-makefile" .
]
Making bundle: binary (in .)
er of parallel builds: 4
darwin/386: github.com/docker/libcompose/cli/main
darwin/amd64: github.com/docker/libcompose/cli/main
linux/386: github.com/docker/libcompose/cli/main
linux/amd64: github.com/docker/libcompose/cli/main
linux/arm: github.com/docker/libcompose/cli/main
windows/386: github.com/docker/libcompose/cli/main
windows/amd64: github.com/docker/libcompose/cli/main
bundles
ompose-cli_darwin-386* libcompose-cli_linux-amd64* libcompose-cli_windows-amd64.exe*
ompose-cli_darwin-amd64* libcompose-cli_linux-arm*
ompose-cli_linux-386* libcompose-cli_windows-386.exe*
go
go
v1.5 or greatergo
v1.6, you need to set export GO15VENDOREXPERIMENT=1
environment variableGOPATH
, you need to set it
accordingly. generate
nerate some stuff
build -o libcompose ./cli/main
A partial implementation of the libcompose-cli CLI is also implemented in Go. The primary purpose of this code is so one can easily test the behavior of libcompose.
Run one of these:
ompose-cli_darwin-386
ompose-cli_linux-amd64
ompose-cli_windows-amd64.exe
ompose-cli_darwin-amd64
ompose-cli_linux-arm
ompose-cli_linux-386
ompose-cli_windows-386.exe
You can run unit tests using the test-unit
target and the
integration test using the test-integration
target. If you don't use
Docker and make
to build libcompose
, you can use go test
and the
following scripts : hack/test-unit
and hack/test-integration
.
ke test-unit
er build -t "libcompose-dev:refactor-makefile" .
Making bundle: test-unit (in .)
test -cover -coverprofile=cover.out ./docker
github.com/docker/libcompose/docker 0.019s coverage: 4.6% of statements
test -cover -coverprofile=cover.out ./project
github.com/docker/libcompose/project 0.010s coverage: 8.4% of statements
test -cover -coverprofile=cover.out ./version
github.com/docker/libcompose/version 0.002s coverage: 0.0% of statements
success
The project is still being kickstarted… But it does a lot. Please try it out and help us find bugs.
Want to hack on libcompose? Docker's contributions guidelines apply.
If you have comments, questions, or want to use your knowledge to help other, come join the conversation on IRC. You can reach us at #libcompose on Freenode.