Files
DFWebOS-Apps/komodo/entrypoint.sh

48 lines
1.5 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# Этот хак можно удалить, если https://github.com/docker-library/docker/pull/444 будет объединен.
# Удалите pid-файл docker, если он существует, чтобы обеспечить запуск Docker после неудачного завершения работы.
pidfile="/var/run/docker.pid"
if [[ -f "${pidfile}" ]]
then
rm -f "${pidfile}"
fi
# Используйте nftables в качестве бэкэнда для iptables
for command in iptables iptables-restore iptables-restore-translate iptables-save iptables-translate
do
ln -sf /sbin/xtables-nft-multi /sbin/$command
done
# Убедитесь, что мост с указанным именем существует.
ensure_bridge_exists() {
local name="${1}"
local ip_range="${2}"
# Проверьте, существует ли мост уже
if ip link show "${name}" &>/dev/null
then
echo "Bridge '${name}' already exists. Skipping creation."
ip addr show "${name}"
return
fi
echo "Bridge '${name}' does not exist. Creating..."
ip link add "${name}" type bridge
ip addr add "${ip_range}" dev "${name}"
ip link set "${name}" up
echo "Bridge '${name}' is now up with IP range '${ip_range}'."
ip addr show "${name}"
}
if [[ "${DOCKER_ENSURE_BRIDGE}" != "" ]]
then
bridge="${DOCKER_ENSURE_BRIDGE%%:*}"
ip_range="${DOCKER_ENSURE_BRIDGE#*:}"
ensure_bridge_exists "${bridge}" "${ip_range}"
fi
exec dockerd-entrypoint.sh $@