diff --git a/Makefile b/Makefile index 09d28f28b8e..520b01205d4 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ RUNC_TEST_IMAGE=runc_test PROJECT=github.com/opencontainers/runc TEST_DOCKERFILE=script/test_Dockerfile +BUILDTAGS=seccomp export GOPATH:=$(CURDIR)/Godeps/_workspace:$(GOPATH) all: - go build -o runc . + go build -tags "$(BUILDTAGS)" -o runc . vet: go get golang.org/x/tools/cmd/vet @@ -20,7 +21,8 @@ test: runctestimage docker run -e TESTFLAGS --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localtest localtest: - go test ${TESTFLAGS} -v ./... + go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v ./... + install: cp runc /usr/local/bin/runc diff --git a/README.md b/README.md index fce024678d5..d8a38fea723 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ make sudo make install ``` +In order to enable seccomp support you will need to install libseccomp on your platform. +If you do not with to build `runc` with seccomp support you can add `BUILDTAGS=""` when running make. + ### Using: To run a container, execute `runc start` in the bundle's root directory: diff --git a/libcontainer/seccomp/seccomp_linux.go b/libcontainer/seccomp/seccomp_linux.go index 4d12c4a1b0d..58bdbf6d633 100644 --- a/libcontainer/seccomp/seccomp_linux.go +++ b/libcontainer/seccomp/seccomp_linux.go @@ -1,4 +1,4 @@ -// +build linux,cgo +// +build linux,cgo,seccomp package seccomp diff --git a/libcontainer/seccomp/seccomp_unsupported.go b/libcontainer/seccomp/seccomp_unsupported.go index 712ad253d75..87d3abbc645 100644 --- a/libcontainer/seccomp/seccomp_unsupported.go +++ b/libcontainer/seccomp/seccomp_unsupported.go @@ -1,12 +1,19 @@ -// +build !linux !cgo +// +build !linux !cgo !seccomp package seccomp import ( + "errors" + "github.com/opencontainers/runc/libcontainer/configs" ) +var ErrSeccompNotEnabled = errors.New("seccomp: config provided but seccomp not supported") + // Seccomp not supported, do nothing func InitSeccomp(config *configs.Seccomp) error { + if config != nil { + return ErrSeccompNotEnabled + } return nil }