2016-04-15 01:54:02 -07:00
# binctr
2018-03-19 22:31:34 -04:00
[](https://travis-ci.org/genuinetools/binctr)
2018-03-19 22:54:29 -04:00
[](https://goreportcard.com/report/github.com/genuinetools/binctr)
[](https://godoc.org/github.com/genuinetools/binctr)
2018-03-19 22:31:34 -04:00
2016-04-15 01:54:02 -07:00
Create fully static, including rootfs embedded, binaries that pop you directly
2016-04-15 22:09:15 -07: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 16:06:20 -07: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-15 22:09:15 -07:00
2018-03-19 23:07:08 -04:00
**HISTORY:** This project used to use a POC fork of libcontainer until [@cyphar ](https://github.com/cyphar )
2018-03-19 22:31:34 -04: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 16:06:20 -07:00
2016-04-15 01:54:02 -07:00
### Building
2018-03-19 22:31:34 -04:00
You will need `libapparmor-dev` and `libseccomp-dev` .
2016-04-16 16:05:09 -07:00
Most importantly you need userns in your kernel (`CONFIG_USER_NS=y` )
or else this won't even work.
2016-04-15 01:54:02 -07:00
```console
2018-03-20 01:46:02 -04:00
# building the alpine example
$ make alpine
Static container created at: ./alpine
2016-04-15 01:54:02 -07:00
2018-03-20 01:46:02 -04:00
# building the busybox example
2018-03-20 02:02:00 -04:00
$ make busybox
2018-03-20 01:46:02 -04:00
Static container created at: ./busybox
2018-03-20 02:02:00 -04:00
# building the cl-k8s example
$ make cl-k8s
Static container created at: ./cl-k8s
2016-04-15 01:54:02 -07:00
```
### Running
```console
$ ./alpine
2018-03-20 01:55:35 -04:00
$ ./busybox
2018-03-20 02:02:00 -04:00
$ ./cl-k8s
2016-04-15 01:54:02 -07:00
```
2016-04-15 22:09:15 -07:00
## Cool things
The binary spawned does NOT need to oversee the container process if you
2016-04-16 16:05:09 -07:00
run in detached mode with a PID file. You can have it watched by the user mode
2016-04-15 22:09:15 -07:00
systemd so that this binary is really just the launcher :)