Forked from leoh0/ensure_privileged_inside_docker_container.sh
Last active
April 5, 2019 14:16
-
-
Save qgp9/8db64ca37af97bc6b1fbc084cea97482 to your computer and use it in GitHub Desktop.
sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function ensure_privileged_or_exit() { | |
local cap_mask="0x00000007ffffffff" | |
local cap_bnd=0x$(grep ^CapBnd /proc/self/status | awk '{print $2}') | |
if [[ $(($cap_mask & $cap_bnd )) != $(($cap_mask)) ]]; then | |
echo -e "[ERROR] Run with --privileged option." | |
exit 1 | |
fi | |
} | |
### Main | |
ensure_privileged_or_exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment