In case we're running on RHEL7 kernel, which has non-working
and broken kernel memory controller, add 'nokmem' build tag
so that runc never enables kmem accounting.
For more info, see the following runc commit:
https://github.com/opencontainers/runc/commit/6a2c1559684
This behavior can be overriden by having `RUNC_NOKMEM` environment
variable set (e.g. to empty value to disable setting nokmem).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
| ... | ... |
@@ -4,10 +4,15 @@ |
| 4 | 4 |
RUNC_COMMIT=9f1e94488e5e478e084fef997f022565b64b01d9 |
| 5 | 5 |
|
| 6 | 6 |
install_runc() {
|
| 7 |
+ # If using RHEL7 kernels (3.10.0 el7), disable kmem accounting/limiting |
|
| 8 |
+ if uname -r | grep -q '^3\.10\.0.*\.el7\.'; then |
|
| 9 |
+ : ${RUNC_NOKMEM='nokmem'}
|
|
| 10 |
+ fi |
|
| 11 |
+ |
|
| 7 | 12 |
# Do not build with ambient capabilities support |
| 8 |
- RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux"}"
|
|
| 13 |
+ RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux $RUNC_NOKMEM"}"
|
|
| 9 | 14 |
|
| 10 |
- echo "Install runc version $RUNC_COMMIT" |
|
| 15 |
+ echo "Install runc version $RUNC_COMMIT (build tags: $RUNC_BUILDTAGS)" |
|
| 11 | 16 |
git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" |
| 12 | 17 |
cd "$GOPATH/src/github.com/opencontainers/runc" |
| 13 | 18 |
git checkout -q "$RUNC_COMMIT" |