diff --git a/mainline/alpine-perl/10-listen-on-ipv6-by-default.sh b/mainline/alpine-perl/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/mainline/alpine-perl/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/mainline/alpine-perl/Dockerfile b/mainline/alpine-perl/Dockerfile
index 3fef8fbee3314bdf4db3a8afd89d5b7a735a1fae..3ac6f43180709aeb81d448fd8d61999ac7cea2f1 100644
--- a/mainline/alpine-perl/Dockerfile
+++ b/mainline/alpine-perl/Dockerfile
@@ -105,13 +105,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/mainline/alpine/10-listen-on-ipv6-by-default.sh b/mainline/alpine/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/mainline/alpine/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/mainline/alpine/Dockerfile b/mainline/alpine/Dockerfile
index 619fc4e9013fae0075aba69e5b86425009f0b09f..afc8a8f19874d2858ed697a5d3d7c5184de9ba3c 100644
--- a/mainline/alpine/Dockerfile
+++ b/mainline/alpine/Dockerfile
@@ -104,13 +104,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/mainline/buster-perl/10-listen-on-ipv6-by-default.sh b/mainline/buster-perl/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/mainline/buster-perl/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/mainline/buster-perl/Dockerfile b/mainline/buster-perl/Dockerfile
index 26ac40ddb968ea716208dd668b08af5ffe32b8c5..8bf66cfb753198629b557f2018644f41147a7359 100644
--- a/mainline/buster-perl/Dockerfile
+++ b/mainline/buster-perl/Dockerfile
@@ -96,13 +96,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/mainline/buster/10-listen-on-ipv6-by-default.sh b/mainline/buster/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/mainline/buster/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/mainline/buster/Dockerfile b/mainline/buster/Dockerfile
index 392e05265090e0977dd473abb6a1027c35749972..4529d063ef2b8a5ff188ce0f76c89e08aa08db7c 100644
--- a/mainline/buster/Dockerfile
+++ b/mainline/buster/Dockerfile
@@ -95,13 +95,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/stable/alpine-perl/10-listen-on-ipv6-by-default.sh b/stable/alpine-perl/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/stable/alpine-perl/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/stable/alpine-perl/Dockerfile b/stable/alpine-perl/Dockerfile
index d470dadab0c7987826a99613305a91edb58fcbb6..f2556fbb41b81f484ca9bb82bfd4348e389089df 100644
--- a/stable/alpine-perl/Dockerfile
+++ b/stable/alpine-perl/Dockerfile
@@ -105,13 +105,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/stable/alpine/10-listen-on-ipv6-by-default.sh b/stable/alpine/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/stable/alpine/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/stable/alpine/Dockerfile b/stable/alpine/Dockerfile
index 32c6746d5333a51370a217e8c5233bdec9426336..462670470098feef0a93be532f40fa3fc7ab6028 100644
--- a/stable/alpine/Dockerfile
+++ b/stable/alpine/Dockerfile
@@ -104,13 +104,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/stable/buster-perl/10-listen-on-ipv6-by-default.sh b/stable/buster-perl/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/stable/buster-perl/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/stable/buster-perl/Dockerfile b/stable/buster-perl/Dockerfile
index 59bcfb0f12b5a6964d0306e180634f3077666d21..5212e28e0fdebcf5dbf9bdedcc11004c972caa73 100644
--- a/stable/buster-perl/Dockerfile
+++ b/stable/buster-perl/Dockerfile
@@ -96,13 +96,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80
diff --git a/stable/buster/10-listen-on-ipv6-by-default.sh b/stable/buster/10-listen-on-ipv6-by-default.sh
new file mode 100755
index 0000000000000000000000000000000000000000..4c52245b92e077dd7c501c6e131cddf61290075a
--- /dev/null
+++ b/stable/buster/10-listen-on-ipv6-by-default.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# vim:sw=4:ts=4:et
+
+set -e
+
+ME=$(basename $0)
+DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
+
+# check if we have ipv6 available
+if [ -f "/proc/net/if_inet6" ]; then
+    continue
+else
+    echo "$ME: ipv6 not available, exiting" 1>&2
+    exit 0
+fi
+
+
+if [ -f "/$DEFAULT_CONF_FILE" ]; then
+    continue
+else
+    echo "$ME: /$DEFAULT_CONF_FILE is not a file or does not exist, exiting" 1>&2
+    exit 0
+fi
+
+if [ -f "/etc/os-release" ]; then
+    . /etc/os-release
+else
+    echo "$ME: can not guess the operating system, exiting" 1>&2
+    exit 0
+fi
+
+echo "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"
+
+case "$ID" in
+    "debian")
+        CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
+        echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packaged version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    "alpine")
+        CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
+        echo "$CHECKSUM  /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
+            echo "$ME: /$DEFAULT_CONF_FILE differs from the packages version, exiting" 1>&2
+            exit 0
+        }
+        ;;
+    *)
+        echo "$ME: Unsupported distribution, exiting" 1>&2
+        exit 0
+        ;;
+esac
+
+# enable ipv6 on default.conf listen sockets
+sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' /$DEFAULT_CONF_FILE
+
+echo "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"
+
+exit 0
diff --git a/stable/buster/Dockerfile b/stable/buster/Dockerfile
index 3b90679517fa368a5a0ae78c17ff60a084dacb02..3050aa882bfe30e316396cf09ea117bae0f15494 100644
--- a/stable/buster/Dockerfile
+++ b/stable/buster/Dockerfile
@@ -95,13 +95,11 @@ RUN set -x \
 # forward request and error logs to docker log collector
     && ln -sf /dev/stdout /var/log/nginx/access.log \
     && ln -sf /dev/stderr /var/log/nginx/error.log \
-# make default server listen on ipv6
-    && sed -i -E 's,listen       80;,listen       80;\n    listen  [::]:80;,' \
-        /etc/nginx/conf.d/default.conf \
 # create a docker-entrypoint.d directory
     && mkdir /docker-entrypoint.d
 
 COPY docker-entrypoint.sh /
+COPY 10-listen-on-ipv6-by-default.sh /docker-entrypoint.d
 ENTRYPOINT ["/docker-entrypoint.sh"]
 
 EXPOSE 80