2016-04-15 08:54:02 +00:00
# binctr
2018-03-20 02:31:34 +00:00
[![Build Status ](https://travis-ci.org/genuinetools/binctr.svg?branch=master )](https://travis-ci.org/genuinetools/binctr)
2018-03-20 02:54:29 +00:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/genuinetools/binctr )](https://goreportcard.com/report/github.com/genuinetools/binctr)
[![GoDoc ](https://godoc.org/github.com/genuinetools/binctr?status.svg )](https://godoc.org/github.com/genuinetools/binctr)
2018-03-20 02:31:34 +00:00
2016-04-15 08:54:02 +00:00
Create fully static, including rootfs embedded, binaries that pop you directly
2016-04-16 05:09:15 +00:00
into a container. **Can be run by an unprivileged user.**
2016-05-02 15:04:53 +00:00
Check out the blog post: [blog.jessfraz.com/post/getting-towards-real-sandbox-containers ](https://blog.jessfraz.com/post/getting-towards-real-sandbox-containers/ ).
2016-04-16 23:06:20 +00:00
This is based off a crazy idea from [@crosbymichael ](https://github.com/crosbymichael )
who first embedded an image in a binary :D
2016-04-16 05:09:15 +00:00
2018-03-20 03:07:08 +00:00
**HISTORY:** This project used to use a POC fork of libcontainer until [@cyphar ](https://github.com/cyphar )
2018-03-20 02:31:34 +00:00
got rootless containers into upstream! Woohoo!
Check out the original thread on the
[mailing list ](https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/yutVaSLcqWI ).
2016-04-16 23:06:20 +00:00
2018-03-20 09:56:20 +00:00
### Checking out this repo
```console
2018-06-12 14:20:16 +00:00
$ git clone git@github.com:genuinetools/binctr.git
2018-03-20 09:56:20 +00:00
```
2016-04-15 08:54:02 +00:00
### Building
2018-03-20 02:31:34 +00:00
You will need `libapparmor-dev` and `libseccomp-dev` .
2016-04-16 23:05:09 +00:00
Most importantly you need userns in your kernel (`CONFIG_USER_NS=y`)
or else this won't even work.
2016-04-15 08:54:02 +00:00
```console
2018-03-20 05:46:02 +00:00
# building the alpine example
$ make alpine
Static container created at: ./alpine
2016-04-15 08:54:02 +00:00
2018-03-20 05:46:02 +00:00
# building the busybox example
2018-03-20 06:02:00 +00:00
$ make busybox
2018-03-20 05:46:02 +00:00
Static container created at: ./busybox
2018-03-20 06:02:00 +00:00
# building the cl-k8s example
$ make cl-k8s
Static container created at: ./cl-k8s
2016-04-15 08:54:02 +00:00
```
### Running
```console
$ ./alpine
2018-03-20 05:55:35 +00:00
$ ./busybox
2018-03-20 06:02:00 +00:00
$ ./cl-k8s
2016-04-15 08:54:02 +00:00
```
2016-04-16 05:09:15 +00:00
## Cool things
The binary spawned does NOT need to oversee the container process if you
2016-04-16 23:05:09 +00:00
run in detached mode with a PID file. You can have it watched by the user mode
2016-04-16 05:09:15 +00:00
systemd so that this binary is really just the launcher :)