diff --git a/dockerfiles/remote-plugin-java11/Dockerfile b/dockerfiles/remote-plugin-java11/Dockerfile
index 7d7434985..8e2ce47c8 100644
--- a/dockerfiles/remote-plugin-java11/Dockerfile
+++ b/dockerfiles/remote-plugin-java11/Dockerfile
@@ -13,4 +13,5 @@ RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpi
&& apk add procps nss \
&& chmod 777 /home/theia
ENV JAVA_HOME /usr/lib/jvm/default-jvm/
+ADD etc/before-start.sh /before-start.sh
WORKDIR /projects
diff --git a/dockerfiles/remote-plugin-java11/etc/before-start.sh b/dockerfiles/remote-plugin-java11/etc/before-start.sh
new file mode 100755
index 000000000..d2f3b0ad4
--- /dev/null
+++ b/dockerfiles/remote-plugin-java11/etc/before-start.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 Red Hat, Inc.
+# This program and the accompanying materials are made
+# available under the terms of the Eclipse Public License 2.0
+# which is available at https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Red Hat, Inc. - initial API and implementation
+#
+
+set_maven_mirror() {
+ local m2="$HOME"/.m2
+ local settingsXML="$m2"/settings.xml
+
+ [ ! -d "$m2" ] && mkdir -p "$m2"
+
+ if [ ! -f "$settingsXML" ]; then
+ echo "> "$settingsXML"
+ echo " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" >> "$settingsXML"
+ echo " xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0" >> "$settingsXML"
+ echo " https://maven.apache.org/xsd/settings-1.0.0.xsd\">" >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo " \${env.MAVEN_MIRROR_URL}" >> "$settingsXML"
+ echo " external:*" >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo "" >> "$settingsXML"
+ else
+ if ! grep -q "\${env.MAVEN_MIRROR_URL}" "$settingsXML"; then
+ if grep -q "" "$settingsXML"; then
+ sed -i 's//\n \n ${env.MAVEN_MIRROR_URL}<\/url>\n external:\*<\/mirrorOf>\n <\/mirror>/' "$settingsXML"
+ else
+ sed -i 's/<\/settings>/ \n \n ${env.MAVEN_MIRROR_URL}<\/url>\n external:*<\/mirrorOf>\n <\/mirror>\n <\/mirrors>\n<\/settings>/' "$settingsXML"
+ fi
+ fi
+ fi
+}
+
+[ ! -z "$MAVEN_MIRROR_URL" ] && set_maven_mirror
+return 0
diff --git a/dockerfiles/remote-plugin-java8/Dockerfile b/dockerfiles/remote-plugin-java8/Dockerfile
index 763488c2e..f64b61766 100644
--- a/dockerfiles/remote-plugin-java8/Dockerfile
+++ b/dockerfiles/remote-plugin-java8/Dockerfile
@@ -11,4 +11,5 @@
FROM ${BUILD_ORGANIZATION}/${BUILD_PREFIX}-theia-endpoint-runtime:${BUILD_TAG}
RUN apk --update --no-cache add openjdk8 procps nss
ENV JAVA_HOME /usr/lib/jvm/default-jvm/
+ADD etc/before-start.sh /before-start.sh
WORKDIR /projects
diff --git a/dockerfiles/remote-plugin-java8/etc/before-start.sh b/dockerfiles/remote-plugin-java8/etc/before-start.sh
new file mode 100755
index 000000000..db000d8ea
--- /dev/null
+++ b/dockerfiles/remote-plugin-java8/etc/before-start.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 Red Hat, Inc.
+# This program and the accompanying materials are made
+# available under the terms of the Eclipse Public License 2.0
+# which is available at https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Red Hat, Inc. - initial API and implementation
+#
+set_maven_mirror() {
+ local m2="$HOME"/.m2
+ local settingsXML="$m2"/settings.xml
+
+ [ ! -d "$m2" ] && mkdir -p "$m2"
+
+ if [ ! -f "$settingsXML" ]; then
+ echo "> "$settingsXML"
+ echo " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" >> "$settingsXML"
+ echo " xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0" >> "$settingsXML"
+ echo " https://maven.apache.org/xsd/settings-1.0.0.xsd\">" >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo " \${env.MAVEN_MIRROR_URL}" >> "$settingsXML"
+ echo " external:*" >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo " " >> "$settingsXML"
+ echo "" >> "$settingsXML"
+ else
+ if ! grep -q "\${env.MAVEN_MIRROR_URL}" "$settingsXML"; then
+ if grep -q "" "$settingsXML"; then
+ sed -i 's//\n \n ${env.MAVEN_MIRROR_URL}<\/url>\n external:\*<\/mirrorOf>\n <\/mirror>/' "$settingsXML"
+ else
+ sed -i 's/<\/settings>/ \n \n ${env.MAVEN_MIRROR_URL}<\/url>\n external:*<\/mirrorOf>\n <\/mirror>\n <\/mirrors>\n<\/settings>/' "$settingsXML"
+ fi
+ fi
+ fi
+}
+
+[ ! -z "$MAVEN_MIRROR_URL" ] && set_maven_mirror
+return 0
diff --git a/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh b/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh
index 1f85f5768..525355a37 100755
--- a/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh
+++ b/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh
@@ -51,6 +51,8 @@ trap 'responsible_shutdown' SIGHUP SIGTERM SIGINT
cd ${HOME}
+[ -f "/before-start.sh" ] && . "/before-start.sh"
+
# run theia endpoint
node /home/theia/lib/node/plugin-remote.js &