forked from sysflow-telemetry/sf-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entry-ubi.sh
executable file
·49 lines (46 loc) · 1.78 KB
/
docker-entry-ubi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -x
rm -fr /usr/src/kernels/ && rm -fr /usr/src/debug/
rm -fr /lib/modules && ln -s $HOST_ROOT/lib/modules /lib/modules
rm -fr /boot && ln -s $HOST_ROOT/boot /boot
if [ -S "/host/var/run/docker.sock" ] ; then
echo "Docker Engine domain socket detected"
fi
echo "CRI_PATH: ${CRI_PATH}"
if [ ! -z "${CRI_PATH}" ] ; then
echo "Adopt CRI_PATH: ${CRI_PATH}"
else
# Auto-detecting the container runtime sockets when CRI_PATH is empty.
# Also providing some information here about the environment
numSocks=0
if [ -S "/host/var/run/crio/crio.sock" ] ; then
echo "CRIO domain socket detected"
CRI_PATH="/var/run/crio/crio.sock"
numSocks=$((numSocks+1))
fi
if [ -S "/host/run/containerd/containerd.sock" ] ; then
echo "Containerd Domain Socket detected"
CRI_PATH="/run/containerd/containerd.sock"
numSocks=$((numSocks+1))
fi
if [ -S "/host/var/run/docker.sock" ] ; then
echo "DOCKER domain socket detected"
# Do not set CRI_PATH here, we will take DOCKER domain socket
numSocks=$((numSocks+1))
fi
echo "${numSocks} container runtime sockets detected"
if [ $numSocks -eq 0 ] ; then
echo "WARNING: Unable to detect container runtime sockets. Will not be able to load container information"
elif [ $numSocks -gt 1 ] ; then
echo "WARNING: Multiple container runtime sockets found. This is not supported. Specify CRI_PATH environmental variable instead."
fi
fi
if [ "${DRIVER_TYPE}" == "ebpf-core" ]; then
echo "Exporting SKIP_DRIVER_LOADER"
export SKIP_DRIVER_LOADER=1
fi
if [ "${DRIVER_TYPE}" == "ebpf" ] && [ -z "${FALCO_BPF_PROBE}" ]; then
echo "Exporting FALCO_BPF_PROBE"
export FALCO_BPF_PROBE=""
fi
exec /usr/local/sysflow/modules/bin/docker-entrypoint.sh "$@"