修改docker代码

This commit is contained in:
bjdgyc
2024-10-24 11:20:45 +08:00
parent 49b40b5ee4
commit 772b1118eb
6 changed files with 31 additions and 10 deletions

View File

@@ -38,7 +38,9 @@ LABEL maintainer="github.com/bjdgyc"
ARG CN="no"
ENV TZ=Asia/Shanghai
ENV ANYLINK_IN_CONTAINER=true
#开关变量 on off
ENV ANYLINK_IN_CONTAINER="on"
ENV IPTABLES_LEGACY="off"
WORKDIR /app
COPY docker/init_release.sh /tmp/

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
var1=$1
#set -x
@@ -19,13 +19,19 @@ case $var1 in
#iptables -nL -t nat
# 启动服务 先判断配置文件是否存在
if [ ! -f /app/conf/profile.xml ]; then
if [[ ! -f /app/conf/profile.xml ]]; then
/bin/cp -r /home/conf-bak/* /app/conf/
echo "After the configuration file is initialized, the container will be forcibly exited. Restart the container."
echo "配置文件初始化完成后,容器会强制退出,请重新启动容器。"
exit 1
fi
# 兼容老版本 iptables
if [[ $IPTABLES_LEGACY == "on" ]]; then
rm /sbin/iptables
ln -s /sbin/iptables-legacy /sbin/iptables
fi
exec /app/anylink "$@"
;;
esac

View File

@@ -13,10 +13,11 @@ fi
# docker 启动使用 4.19 以上内核
apk add --no-cache ca-certificates bash iproute2 tzdata iptables
# alpine:3.19 兼容老版 iptables
# alpine:3.19 兼容老版 iptables
apk add --no-cache iptables-legacy
rm /sbin/iptables
ln -s /sbin/iptables-legacy /sbin/iptables
#rm /sbin/iptables
#ln -s /sbin/iptables-legacy /sbin/iptables
chmod +x /app/docker_entrypoint.sh