Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Work around bad hostname detection during postfix package install. (#9878)

Dan3d5ef519e0cd
diff --git a/docker/prod/setup/preinstall-on-prem.sh b/docker/prod/setup/preinstall-on-prem.sh
index adbd18c4af7..d03583a61f9 100755
--- a/docker/prod/setup/preinstall-on-prem.sh
+++ b/docker/prod/setup/preinstall-on-prem.sh
@@ -2,6 +2,18 @@
set -e
set -o pipefail
+# postfix.postinst tries to generate a hostname based on /etc/resolv.conf, which
+# gets copied in to the docker environment from the host system. On systems
+# that are not on a network with a domain, this will result in a failed install.
+#
+# See https://salsa.debian.org/postfix-team/postfix-dev/-/blob/debian/buster-updates/debian/postfix.postinst#L40
+if [ -f /run/.containerenv -o -f /.dockerenv ]; then
+ mv /bin/hostname /bin/x-hostname
+ echo openproject.local > /etc/hostname
+ apt-get install -y postfix
+ mv /bin/x-hostname /bin/hostname
+fi
+
apt-get install -y \
memcached \
postfix \