Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: load kernelmodules: loop, binfmt_misc #373

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,40 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

BUILD_OPTS="$*"

DOCKER="docker"

if ! ${DOCKER} ps >/dev/null 2>&1; then
DOCKER="sudo docker"
SUDO=''
if [ $EUID != 0 ]; then
SUDO='sudo'
fi

function install_binfmt_support {
local binfmtSupport="binfmt-support"
if ! dpkg -s $binfmtSupport &>/dev/null; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the docker build is especially made to be run on other distros like Fedora & CentOS this should be taken into consideration here. So please also support rpm or ignore OSes other than Ubuntu & Debian.

echo "please install $binfmtSupport with this command: $SUDO apt-get install $binfmtSupport"
exit 1
fi
}

function load_kernelmodule {
local kernelMod="$1"
if ! $SUDO modinfo $kernelMod &>/dev/null; then
echo "missing this kernel modul: $kernelMod"
exit 1
else
if $SUDO modprobe -n --first-time $kernelMod &>/dev/null; then
echo "loading kernel module $kernelMod"
$SUDO modprobe $kernelMod
fi
fi
}

install_binfmt_support

load_kernelmodule loop
load_kernelmodule binfmt_misc


DOCKER="$SUDO docker"

if ! ${DOCKER} ps >/dev/null; then
echo "error connecting to docker:"
${DOCKER} ps
Expand Down