Docker container data goes blank when mapped with host data directory - docker

I have created a Dockerfile like below. Just adding up an application in tomcat webapps.
FROM tomcat:9-alpine
ADD ./Spring3HibernateApp.war /usr/local/tomcat/webapps/
VOLUME /usr/local/tomcat/webapps
EXPOSE 8080
CMD ["catalina.sh","run"]
Build up a new image and named it test-app:0.1
docker build –t test-app:0.1 .
Spinning up new container like below, where I am using host data directory to mount a container data directory, so that I can make changes or list webapps content of container.
docker run -d --name=tomcat-01 -p 80:8080 --net=bridge -v /vol2/docker/sampleapp/tomcat-webapps:/usr/local/tomcat/webapps test-app:0.1
My problem: When I look at /vol2/docker/sampleapp/tomcat-webapps, I found it blank. However I am thinking it should list out contents of container from location /usr/local/tomcat/webapps. It’s actually cleaning up containers data as well, instead of persisting it and loading it in host data directory.
Am I missing anything?
If I simply remove –v from above command, it works fine and I am able to see contents inside default docker volume location, but not getting same result when I add –v.
Is my understand wrong?
I am referring “Mount a host directory as a data volume” through link https://docs.docker.com/engine/tutorials/dockervolumes/
Same command is working fine, when I am using mysql image and spinning up new container from it.
docker run -d --name=mysql-01 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=employeedb --net=bridge -v /vol2/docker/sampleapp/mysql-data:/var/lib/mysql mysql
This time, I am able to see containers data inside /vol2/docker/sampleapp/mysql-data

When you mount a volume you overwrite the existing directory inside of the container. If you are looking to deploy .war or .jar files from outside of the container you would want to do the following:
FROM tomcat:9-alpine
VOLUME /usr/local/tomcat/webapps
EXPOSE 8080
CMD ["catalina.sh","run"]
Build it: docker build –t test-app:0.1 .
Then run your container like so: docker run -d --name=tomcat-01 -p 80:8080 -v /vol2/docker/sampleapp/tomcat-webapps:/usr/local/tomcat/webapps test-app:0.1 placing the Spring3HibernateApp.war in the /vol2/docker/sampleapp/tomcat-webapps directory.
Once you do this you can go docker logs -f tomcat-01 and watch as tomcat deploys the app like in my sample.war below.
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8-openjdk/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
25-Feb-2017 21:58:23.710 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/9.0.0.M17
25-Feb-2017 21:58:23.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jan 10 2017 20:59:20 UTC
25-Feb-2017 21:58:23.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.0.0
25-Feb-2017 21:58:23.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
25-Feb-2017 21:58:23.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.13.0-93-generic
25-Feb-2017 21:58:23.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
25-Feb-2017 21:58:23.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8-openjdk/jre
25-Feb-2017 21:58:23.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_111-internal-alpine-r0-b14
25-Feb-2017 21:58:23.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
25-Feb-2017 21:58:23.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
25-Feb-2017 21:58:23.718 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
25-Feb-2017 21:58:23.719 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
25-Feb-2017 21:58:23.719 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
25-Feb-2017 21:58:23.719 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
25-Feb-2017 21:58:23.720 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
25-Feb-2017 21:58:23.720 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
25-Feb-2017 21:58:23.721 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
25-Feb-2017 21:58:23.721 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
25-Feb-2017 21:58:23.721 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.10 using APR version 1.5.2.
25-Feb-2017 21:58:23.721 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
25-Feb-2017 21:58:23.722 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
25-Feb-2017 21:58:23.725 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2j 26 Sep 2016)
25-Feb-2017 21:58:23.838 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
25-Feb-2017 21:58:23.861 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Feb-2017 21:58:23.868 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
25-Feb-2017 21:58:23.870 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Feb-2017 21:58:23.874 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 653 ms
25-Feb-2017 21:58:23.908 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
25-Feb-2017 21:58:23.908 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.0.M17
25-Feb-2017 21:58:23.951 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /usr/local/tomcat/webapps/sample.war
25-Feb-2017 22:00:25.223 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [120,610] milliseconds.
25-Feb-2017 22:00:25.253 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/webapps/sample.war has finished in 121,302 ms
25-Feb-2017 22:00:25.258 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio-8080]
25-Feb-2017 22:00:25.270 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8009]
25-Feb-2017 22:00:25.278 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 121403 ms
Lastly, the MySQL volume mount works like it does because the base image had the volume exposed before as it was build VOLUME /var/lib/mysql if you wanted the same thing to occur in the catalina app you would have to copy their Dockerfile and add a VOLUME /usr/local/tomcat/webapps/ to it like below.
FROM openjdk:8-jre-alpine
ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME
# let "Tomcat Native" live somewhere isolated
ENV TOMCAT_NATIVE_LIBDIR $CATALINA_HOME/native-jni-lib
ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOMCAT_NATIVE_LIBDIR
RUN apk add --no-cache gnupg
# see https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/KEYS
# see also "update.sh" (https://github.com/docker-library/tomcat/blob/master/update.sh)
ENV GPG_KEYS 05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23
RUN set -ex; \
for key in $GPG_KEYS; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
ENV TOMCAT_MAJOR 9
ENV TOMCAT_VERSION 9.0.0.M17
# https://issues.apache.org/jira/browse/INFRA-8753?focusedCommentId=14735394#comment-14735394
ENV TOMCAT_TGZ_URL https://www.apache.org/dyn/closer.cgi?action=download&filename=tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz
# not all the mirrors actually carry the .asc files :'(
ENV TOMCAT_ASC_URL https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz.asc
RUN set -x \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
tar \
openssl \
&& wget -O tomcat.tar.gz "$TOMCAT_TGZ_URL" \
&& wget -O tomcat.tar.gz.asc "$TOMCAT_ASC_URL" \
&& gpg --batch --verify tomcat.tar.gz.asc tomcat.tar.gz \
&& tar -xvf tomcat.tar.gz --strip-components=1 \
&& rm bin/*.bat \
&& rm tomcat.tar.gz* \
\
&& nativeBuildDir="$(mktemp -d)" \
&& tar -xvf bin/tomcat-native.tar.gz -C "$nativeBuildDir" --strip-components=1 \
&& apk add --no-cache --virtual .native-build-deps \
apr-dev \
gcc \
libc-dev \
make \
"openjdk${JAVA_VERSION%%[-~bu]*}"="$JAVA_ALPINE_VERSION" \
openssl-dev \
&& ( \
export CATALINA_HOME="$PWD" \
&& cd "$nativeBuildDir/native" \
&& ./configure \
--libdir="$TOMCAT_NATIVE_LIBDIR" \
--prefix="$CATALINA_HOME" \
--with-apr="$(which apr-1-config)" \
--with-java-home="$(docker-java-home)" \
--with-ssl=yes \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
) \
&& runDeps="$( \
scanelf --needed --nobanner --recursive "$TOMCAT_NATIVE_LIBDIR" \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .tomcat-native-rundeps $runDeps \
&& apk del .fetch-deps .native-build-deps \
&& rm -rf "$nativeBuildDir" \
&& rm bin/tomcat-native.tar.gz
# verify Tomcat Native is working properly
RUN set -e \
&& nativeLines="$(catalina.sh configtest 2>&1)" \
&& nativeLines="$(echo "$nativeLines" | grep 'Apache Tomcat Native')" \
&& nativeLines="$(echo "$nativeLines" | sort -u)" \
&& if ! echo "$nativeLines" | grep 'INFO: Loaded APR based Apache Tomcat Native library' >&2; then \
echo >&2 "$nativeLines"; \
exit 1; \
fi
ADD ./Spring3HibernateApp.war /
VOLUME ${CATALINA_HOME}
EXPOSE 8080
CMD ["catalina.sh", "run"]

When you mount a host directory into the container, anything inside the container at that path is no longer available. It is still there in the underlying image or volume, but it will be superseded by your volume mount.
That is simply how host volume mounts work: Whatever is in the directory on your host is slapped into place inside the container, and takes precedence over whatever was previously at that path (if anything was).

I am afraid your VOLUME /usr/local/tomcat/webapps clears this directory.
You need to do it differently.

Related

supervisor manages a process which is started up with a shell script

I'm using supervisord to run multi-service in a container. I want a ldap service for my web application. So I installed and started opendj with the follow info,
Dockerfile
RUN dpkg -i $APP_HOME/packages/opendj_3.0.0-1_all.deb && \
/opt/opendj/setup \
--cli \
--backendType je \
--baseDN dc=test,dc=net \
--ldapPort 389 \
--adminConnectorPort 4444 \
--rootUserDN cn=Directory\ Manager \
--rootUserPassword 123456 \
--no-prompt \
--noPropertiesFile \
--acceptLicense \
--doNotStart
supervisord.conf
[program:ldap]
command=/opt/opendj/bin/start-ds
priority=1
When running my customized imgae, I got the following exiting message for ldap.
2020-05-25 06:46:03,486 INFO exited: ldap (exit status 0; expected)
Logging into the container to get all process status info with supervisorctl status all and ps -aux respectively.
$supervisorctl status all
ldap EXITED May 25 06:46 AM
$ps -aux
root 97 3.4 5.9 3489048 240248 pts/0 Sl 06:15 0:08 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -server -Dorg.opends.server.scriptName=start-ds org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler
I found the ldap program starting up with start-ds shell script, that is, that start-ds shell process exited, but the ldap server which isn't controlled by supervisor is running.
If stopping supervisor subprocesses, the ldap server can't be stopped gracefully.
So my question is how to configure to make the supervisor to control the ldap server process which is started up by start-ds.
There is a --nodetach option that you should use in such cases: https://github.com/ForgeRock/opendj-community-edition/blob/master/resource/bin/start-ds#L60
Reference Doc says:
Options
The start-ds command takes the following options:
-N | --nodetach
Do not detach from the terminal and continue running in the foreground. This option cannot be used with the -t, --timeout option.
Default: false
The statement in start-ds.sh file is:
exec "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
org.opends.server.core.DirectoryServer \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${CONFIG_FILE}" "${#}"
start-ds script will append this option when run /opt/opendj/bin/start-ds -N
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -server -Dorg.opends.server.scriptName=start-ds org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile /opt/opendj/config/config.ldif -N

Error while trying to play a video with Gstreamer in a Docker environment

Im building a python based video player but ran in to a issue with Gstreamer.
I get a bunch of error messages when trying to play a video on a raspberry pi 3 with the 7 inch touchscreen. Im running in a docker environment on the platform Balena.io
startx /usr/bin/gst-launch-1.0 -ve playbin uri=file:///usr/src/app/big_buck_bunny_720p_stereo.avi
[Logs] [2019-7-18 6:54:14 PM] [main] Got context from element 'sink': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0";
[Logs] [2019-7-18 6:54:14 PM] [main] error: XDG_RUNTIME_DIR not set in the environment.
[Logs] [2019-7-18 6:54:14 PM] [main] WARNING: from element /GstWaylandSink:waylandsink0: Could not initialise Wayland output
[Logs] [2019-7-18 6:54:14 PM] [main] Additional debug info:
[Logs] [2019-7-18 6:54:14 PM] [main] gstwaylandsink.c(289): gst_wayland_sink_find_display (): /GstWaylandSink:waylandsink0:
[Logs] [2019-7-18 6:54:14 PM] [main] Redistribute latency...
[Logs] [2019-7-18 6:54:14 PM] [main] Failed to create GstWlDisplay: 'Failed to connect to the wayland display '(default)''
In my dockerfile i install the following:
RUN apt-get update && apt-get install --no-install-recommends \
xserver-xorg \
xinit \
xterm \
xfonts-utils \
xfonts-traditional \
python3-gi \
python3-gst-1.0 \
python3-gi-cairo \
gir1.2-gtk-3.0 \
gstreamer1.0-libav \
libgstreamer1.0-0-dbg \
gstreamer1.0-tools \
libgstreamer-plugins-base1.0-0 \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
gstreamer1.0-plugins-bad-dbg \
gstreamer1.0-omx \
gstreamer1.0-alsa
As i can understand it, Gstreamer uses Wayland instead of Xserver, but i cant figure out how/what i should set XDG_RUNTIME_DIR to or if there is something else that needs to be exported in order to get Wayland to recognize the display?

How to bind mounted persistent volumes on docker ? I'm trying to run Sonarqube on docker

I want to run SonarQube on docker. When I run the whiteout volume persist option, it works properly with this command:
docker run -d --name sonarqube -p 9000:9000 sonarqube
But when I try to set bind-mounted persistent volumes, my docker doesn't start. The docker command used is:
docker run -d --name sonarqube \
-p 9000:9000 \
-v /opt/docker-mounts/sonaarqube/conf:/opt/sonarqube/conf \
-v /opt/docker-mounts/sonaarqube/data:/opt/sonarqube/data \
-v /opt/docker-mounts/sonaarqube/logs:/opt/sonarqube/logs \
-v /opt/docker-mounts/sonaarqube/extensions:/opt/sonarqube/extensions \
sonarqube
Note: I run docker command with root privilege.
I use this SonarQube image from Docker Hub: https://hub.docker.com/_/sonarqube?tab=description
I get this Error in docker logs :
>
06:42:37.293 [main] WARN org.sonar.application.config.AppSettingsLoaderImpl - Configuration file not found: /opt/sonarqube/conf/sonar.properties
2019.07.07 06:42:37 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.07.07 06:42:37 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.07.07 06:42:37 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.07.07 06:42:38 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.07.07 06:42:38 INFO app[][o.e.p.PluginsService] no modules loaded
2019.07.07 06:42:38 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019-07-07 06:42:41,143 main ERROR Unable to create file /opt/sonarqube/logs/es.log java.io.IOException: Permission denied
at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.base/java.io.File.createNewFile(File.java:1024)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:628)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:608)
at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113)
at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:145)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:61)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,148 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory#5dcd8c7a] unable to create manager for [/opt/sonarqube/logs/es.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData#2250b9f2[pattern=/opt/sonarqube/logs/es.%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=-2147483648, max=2147483647, useMax=false), advertiseURI=null, layout=%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{1.}] %msg%n, filePermissions=null, fileOwner=null]] java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory#5dcd8c7a] unable to create manager for [/opt/sonarqube/logs/es.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData#2250b9f2[pattern=/opt/sonarqube/logs/es.%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=-2147483648, max=2147483647, useMax=false), advertiseURI=null, layout=%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{1.}] %msg%n, filePermissions=null, fileOwner=null]]
at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:115)
at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:145)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:61)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,152 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:235)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,154 main ERROR Null object returned for RollingFile in Appenders.
2019-07-07 06:42:41,154 main ERROR Unable to locate appender "file_es" for logger config "root"
2019.07.07 06:42:41 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2019.07.07 06:42:41 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.07.07 06:42:41 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
I think you have persistented the volumes but there is no file and required permissions. Follow below steps.
Start the container without persistent volume
$ docker run -d --name sonarqube -p 9000:9000 sonarqube
$ docker ps -f name=sonarqube
Note down the container id.
Copy folders from the container to host directory
$ cd /opt/docker-mounts/sonaarqube
$ chown -R 999:999 .
$ docker cp -a CONTAINER_ID:/opt/sonarqube/conf .
$ docker cp -a CONTAINER_ID:/opt/sonarqube/logs . # this can be skipped is not required
$ docker cp -a CONTAINER_ID:/opt/sonarqube/data . # optional, if you need the existing data from the container
$ docker cp -a CONTAINER_ID:/opt/sonarqube/extensions .
Now start the container with persistent volumes
$ docker run -d --name sonarqube \
-p 9000:9000 \
-v /opt/docker-mounts/sonaarqube/conf:/opt/sonarqube/conf \
-v /opt/docker-mounts/sonaarqube/data:/opt/sonarqube/data \
-v /opt/docker-mounts/sonaarqube/logs:/opt/sonarqube/logs \
-v /opt/docker-mounts/sonaarqube/extensions:/opt/sonarqube/extensions \
sonarqube

How can I build "tomee 7.0.5 plume" Docker image using openjdk 10? -or is this not possible?

How can I build "tomee 7.0.5 plume" Docker image using openjdk 10?
- or is this not possible?
Thought I could do so by editing the Dockerfile located at...
https://github.com/tomitribe/docker-tomee/blob/29e41238711b95a407434783a84cadf1c4630f6e/8-jre-7.0.5-plume/Dockerfile
(note: the edited "Dockerfile" is listed below... -just changed the openjdk version to 10)
...but, result is always: returned a non-zero code: 7
Ran the build command like this...
docker build -t tomee10 .
Output looks like this...
BBEKOFT#AAXA22A747 /cygdrive/c/tools/tomee10_stuff
$ docker build -t tomee10 .
Sending build context to Docker daemon 11.78kB
Step 1/9 : FROM openjdk:10-jre
---> 996f362f73b9
Step 2/9 : ENV PATH /usr/local/tomee/bin:$PATH
---> Running in 9bf64e59f639
Removing intermediate container 9bf64e59f639
---> 7e37b0fe7fd0
Step 3/9 : RUN mkdir -p /usr/local/tomee
---> Running in 36c396da9335
Removing intermediate container 36c396da9335
---> ddb4e7361df6
Step 4/9 : WORKDIR /usr/local/tomee
Removing intermediate container fc840f7153ba
---> 67293830ce94
Step 5/9 : ENV GPG_KEYS 223D3A74B068ECA354DC385CE126833F9CF64915 678F2D98F1FD9643811639FB622B8F2D043F71D8 7A2744A8A9AAF063C23EB7868EBE7DBE8D050EEF 82D8419BA697F0E7FB85916EE91287822FDB81B1 9056B710F1E332780DE7AF34CBAEBE39A46C4CA1 A57DAF81C1B69921F4BA8723A8DE0A4DB863A7C1 B7574789F5018690043E6DD9C212662E12F3E1DD B8B301E6105DF628076BD92C5483E55897ABD9B9 BDD0BBEB753192957EFC5F896A62FC8EF17D8FEF C23A3F6F595EBD0F960270CC997C8F1A5BE6E4C1 D11DF12CC2CA4894BDE638B967C1227A2678363C DBCCD103B8B24F86FFAAB025C8BB472CD297D428 F067B8140F5DD80E1D3B5D92318242FE9A0B1183 FAA603D58B1BA4EDF65896D0ED340E0E6D545F97
---> Running in 2f21c75ec995
Removing intermediate container 2f21c75ec995
---> 093ff03dc636
Step 6/9 : RUN set -xe && for key in $GPG_KEYS; do gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys "$key"; done
---> Running in 5a053e4ce201
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys 223D3A74B068ECA354DC385CE126833F9CF64915
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: key E126833F9CF64915: 4 signatures not checked due to missing keys
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key E126833F9CF64915: public key "Richard Kenneth McGuire (CODE SIGNING KEY) <rickmcguire#apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys 678F2D98F1FD9643811639FB622B8F2D043F71D8
gpg: key 622B8F2D043F71D8: public key "Jean-Louis Monteiro (CODE SIGNING KEY) <jlmonteiro#apache.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys 7A2744A8A9AAF063C23EB7868EBE7DBE8D050EEF
gpg: key 8EBE7DBE8D050EEF: 3 signatures not checked due to missing keys
gpg: key 8EBE7DBE8D050EEF: public key "Jarek Gawor (CODE SIGNING KEY) <gawor#apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys 82D8419BA697F0E7FB85916EE91287822FDB81B1
gpg: key E91287822FDB81B1: 1 signature not checked due to a missing key
gpg: key E91287822FDB81B1: public key "Mark Struberg (Apache) <struberg#apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys 9056B710F1E332780DE7AF34CBAEBE39A46C4CA1
gpg: key CBAEBE39A46C4CA1: 45 signatures not checked due to missing keys
gpg: key CBAEBE39A46C4CA1: public key "Matt Hogstrom <hogstrom#apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys A57DAF81C1B69921F4BA8723A8DE0A4DB863A7C1
gpg: key A8DE0A4DB863A7C1: public key "Romain Manni-Bucau <rmannibucau#tomitribe.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys B7574789F5018690043E6DD9C212662E12F3E1DD
gpg: key C212662E12F3E1DD: 1 signature not checked due to a missing key
gpg: key C212662E12F3E1DD: public key "David Blevins <dblevins#apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys B8B301E6105DF628076BD92C5483E55897ABD9B9
gpg: key 5483E55897ABD9B9: 2 signatures not checked due to missing keys
gpg: key 5483E55897ABD9B9: public key "Jarek Gawor <gawor#apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys BDD0BBEB753192957EFC5F896A62FC8EF17D8FEF
gpg: key 6A62FC8EF17D8FEF: public key "Romain Manni-Bucau <rmannibucau#apache.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys C23A3F6F595EBD0F960270CC997C8F1A5BE6E4C1
gpg: key 997C8F1A5BE6E4C1: 5 signatures not checked due to missing keys
gpg: key 997C8F1A5BE6E4C1: public key "Xu Hai Hong (Ivan Xu # Geronimo) <xhhsld#gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys D11DF12CC2CA4894BDE638B967C1227A2678363C
gpg: key 67C1227A2678363C: public key "Romain Manni-Bucau <rmannibucau#apache.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys DBCCD103B8B24F86FFAAB025C8BB472CD297D428
gpg: key C8BB472CD297D428: public key "Jonathan Gallimore <jgallimore#apache.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys F067B8140F5DD80E1D3B5D92318242FE9A0B1183
gpg: key 318242FE9A0B1183: public key "Jeremy Whitlock <jwhitlock#apache.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
+ gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=proxy.apps.dhs.gov:80 --recv-keys FAA603D58B1BA4EDF65896D0ED340E0E6D545F97
gpg: key ED340E0E6D545F97: public key "Andy Gumbrecht (TomEE Code Signing) <agumbrecht#tomitribe.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
Removing intermediate container 5a053e4ce201
---> 2112f839516f
Step 7/9 : RUN set -x && curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz.asc -o tomee.tar.gz.asc && curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz -o tomee.tar.gz && gpg --batch --verify tomee.tar.gz.asc tomee.tar.gz && tar -zxf tomee.tar.gz && mv apache-tomee-plume-7.0.5/* /usr/local/tomee && rm -Rf apache-tomee-plume-7.0.5 && rm bin/*.bat && rm tomee.tar.gz*
---> Running in e48a17dabf11
+ curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz.asc -o tomee.tar.gz.asc
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:20 --:--:-- 0curl: (7) Failed to connect to repo.maven.apache.org port 443: Connection refused
The command '/bin/sh -c set -x && curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz.asc -o tomee.tar.gz.asc && curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz -o tomee.tar.gz && gpg --batch --verify tomee.tar.gz.asc tomee.tar.gz && tar -zxf tomee.tar.gz && mv apache-tomee-plume-7.0.5/* /usr/local/tomee && rm -Rf apache-tomee-plume-7.0.5 && rm bin/*.bat && rm tomee.tar.gz*' returned a non-zero code: 7
BBEKOFT#AAXA22A747 /cygdrive/c/tools/tomee10_stuff
$
Here is the edited Dockerfile (modified the openjdk version)...
FROM openjdk:10-jre
ENV PATH /usr/local/tomee/bin:$PATH
RUN mkdir -p /usr/local/tomee
WORKDIR /usr/local/tomee
# curl -fsSL 'https://www.apache.org/dist/tomee/KEYS' | awk -F ' = ' '$1 ~ /^ +Key fingerprint$/ { gsub(" ", "", $2); print $2 }' | sort -u
ENV GPG_KEYS \
223D3A74B068ECA354DC385CE126833F9CF64915 \
678F2D98F1FD9643811639FB622B8F2D043F71D8 \
7A2744A8A9AAF063C23EB7868EBE7DBE8D050EEF \
82D8419BA697F0E7FB85916EE91287822FDB81B1 \
9056B710F1E332780DE7AF34CBAEBE39A46C4CA1 \
A57DAF81C1B69921F4BA8723A8DE0A4DB863A7C1 \
B7574789F5018690043E6DD9C212662E12F3E1DD \
B8B301E6105DF628076BD92C5483E55897ABD9B9 \
BDD0BBEB753192957EFC5F896A62FC8EF17D8FEF \
C23A3F6F595EBD0F960270CC997C8F1A5BE6E4C1 \
D11DF12CC2CA4894BDE638B967C1227A2678363C \
DBCCD103B8B24F86FFAAB025C8BB472CD297D428 \
F067B8140F5DD80E1D3B5D92318242FE9A0B1183 \
FAA603D58B1BA4EDF65896D0ED340E0E6D545F97
RUN set -xe \
&& for key in $GPG_KEYS; do \
gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=myproxy_url:80 --recv-keys "$key"; \
done
RUN set -x \
&& curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz.asc -o tomee.tar.gz.asc \
&& curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz -o tomee.tar.gz \
&& gpg --batch --verify tomee.tar.gz.asc tomee.tar.gz \
&& tar -zxf tomee.tar.gz \
&& mv apache-tomee-plume-7.0.5/* /usr/local/tomee \
&& rm -Rf apache-tomee-plume-7.0.5 \
&& rm bin/*.bat \
&& rm tomee.tar.gz*
EXPOSE 8084
CMD ["catalina.sh", "run"]
Worked when I modified Dockerfile like this…
FROM openjdk:10-jre
ENV PATH /usr/local/tomee/bin:$PATH
RUN mkdir -p /usr/local/tomee
WORKDIR /usr/local/tomee
# curl -fsSL 'https://www.apache.org/dist/tomee/KEYS' | awk -F ' = ' '$1 ~ /^ +Key fingerprint$/ { gsub(" ", "", $2); print $2 }' | sort -u
ENV GPG_KEYS \
223D3A74B068ECA354DC385CE126833F9CF64915 \
678F2D98F1FD9643811639FB622B8F2D043F71D8 \
7A2744A8A9AAF063C23EB7868EBE7DBE8D050EEF \
82D8419BA697F0E7FB85916EE91287822FDB81B1 \
9056B710F1E332780DE7AF34CBAEBE39A46C4CA1 \
A57DAF81C1B69921F4BA8723A8DE0A4DB863A7C1 \
B7574789F5018690043E6DD9C212662E12F3E1DD \
B8B301E6105DF628076BD92C5483E55897ABD9B9 \
BDD0BBEB753192957EFC5F896A62FC8EF17D8FEF \
C23A3F6F595EBD0F960270CC997C8F1A5BE6E4C1 \
D11DF12CC2CA4894BDE638B967C1227A2678363C \
DBCCD103B8B24F86FFAAB025C8BB472CD297D428 \
F067B8140F5DD80E1D3B5D92318242FE9A0B1183 \
FAA603D58B1BA4EDF65896D0ED340E0E6D545F97
RUN set -xe \
&& for key in $GPG_KEYS; do \
gpg --keyserver pgp.mit.edu --keyserver-options http-proxy=<your proxy url:port> --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --keyserver-options http-proxy=<your proxy url:port> --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --keyserver-options http-proxy=<your proxy url:port> --recv-keys "$key" ; \
done
RUN set -x \
&& curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz.asc --proxy <your proxy url>:80 -o tomee.tar.gz.asc \
&& curl -fSL https://repo.maven.apache.org/maven2/org/apache/tomee/apache-tomee/7.0.5/apache-tomee-7.0.5-plume.tar.gz --proxy <your proxy url>:80 -o tomee.tar.gz \
&& gpg --batch --verify tomee.tar.gz.asc tomee.tar.gz \
&& tar -zxf tomee.tar.gz \
&& mv apache-tomee-plume-7.0.5/* /usr/local/tomee \
&& rm -Rf apache-tomee-plume-7.0.5 \
&& rm bin/*.bat \
&& rm tomee.tar.gz*
EXPOSE 8084
CMD ["catalina.sh", "run"]
(1)
change to the directory with the Dockerfile file
$ docker build -t tomee10 .
(2)
$ docker run -it --rm -p 8888:8084 -v tomeevolume:/usr/local/tomee b21587558d62 /bin/bash
i.e., where b21587558d62 is the “IMAGE_ID”
(3)
update server.xml as needed:
docker cp server.xml cbff3129c954:/usr/local/tomee/conf/server.xml
(note: cbff3129c954 comes from my prompt: root#cbff3129c954:/usr/local/tomee# )
i.e. where “server.xml” looks like this…
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<!-- TomEE plugin for Tomcat -->
<Listener className="org.apache.tomee.catalina.ServerListener" />
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8084" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" xpoweredBy="false" server="Apache TomEE" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
(4)
update tomcat-users.xml as needed:
docker cp tomcat-users.xml cbff3129c954:/usr/local/tomee/conf/tomcat-users.xml
(note: cbff3129c954 comes from my prompt: root#cbff3129c954:/usr/local/tomee# )
i.e., where tomcat-users.xml looks like this…
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0">
<role rolename="tomcat"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="tomee-admin" />
<user username="tomcat" password="s3cret" roles="tomcat,manager-gui,admin-gui,tomee-admin"/>
<user username="tomee" password="s3cret" roles="tomcat,manager-gui,admin-gui,tomee-admin" />
</tomcat-users>
(5)
update context.xml as needed:
docker cp context.xml cbff3129c954:/usr/local/tomee/webapps/manager/META-INF/context.xml
(note: cbff3129c954 comes from my prompt: root#cbff3129c954:/usr/local/tomee# )
i.e., where context.xml looks like this…
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
(6)
$ docker run -it --rm -p 8888:8084 -v tomeevolume:/usr/local/tomee b21587558d62 /bin/bash
root#33c49b8920ec:/usr/local/tomee# cd bin
root#33c49b8920ec:/usr/local/tomee/bin# ./catalina.sh run
Using CATALINA_BASE: /usr/local/tomee
Using CATALINA_HOME: /usr/local/tomee
Using CATALINA_TMPDIR: /usr/local/tomee/temp
Using JRE_HOME: /docker-java-home
Using CLASSPATH: /usr/local/tomee/bin/bootstrap.jar:/usr/local/tomee/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
13-Aug-2018 18:22:12.153 INFO [main] org.apache.openejb.persistence.PersistenceBootstrap.getDefaultProvider Default JPA Provider changed to org.eclipse.persistence.jpa.PersistenceProvider specified by jar:file:/usr/local/tomee/lib/openejb-core-eclipselink-7.0.5.jar!/META-INF/org.apache.openejb.persistence.PersistenceBootstrap.provider
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.tomee.catalina.ServerListener (file:/usr/local/tomee/lib/tomee-catalina-7.0.5.jar) to field java.lang.reflect.Field.modifiers
WARNING: Please consider reporting this to the maintainers of org.apache.tomee.catalina.ServerListener
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
13-Aug-2018 18:22:12.828 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Server version: Apache Tomcat (TomEE)/8.5.32 (7.0.5)
13-Aug-2018 18:22:12.828 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Server built: Jun 20 2018 19:50:35 UTC
13-Aug-2018 18:22:12.828 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Server number: 8.5.32.0
13-Aug-2018 18:22:12.828 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke OS Name: Linux
13-Aug-2018 18:22:12.828 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke OS Version: 4.9.87-linuxkit-aufs
13-Aug-2018 18:22:12.829 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Architecture: amd64
13-Aug-2018 18:22:12.829 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Java Home: /usr/lib/jvm/java-10-openjdk-amd64
13-Aug-2018 18:22:12.829 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke JVM Version: 10.0.2+13-Debian-1
13-Aug-2018 18:22:12.829 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke JVM Vendor: Oracle Corporation
13-Aug-2018 18:22:12.829 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke CATALINA_BASE: /usr/local/tomee
13-Aug-2018 18:22:12.829 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke CATALINA_HOME: /usr/local/tomee
13-Aug-2018 18:22:12.830 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
13-Aug-2018 18:22:12.830 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
13-Aug-2018 18:22:12.830 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
13-Aug-2018 18:22:12.830 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Command line argument: -Djava.util.logging.config.file=/usr/local/tomee/conf/logging.properties
13-Aug-2018 18:22:12.831 INFO [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
13-Aug-2018 18:22:12.832 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -javaagent:/usr/local/tomee/lib/openejb-javaagent.jar
13-Aug-2018 18:22:12.832 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
13-Aug-2018 18:22:12.832 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
13-Aug-2018 18:22:12.833 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
13-Aug-2018 18:22:12.833 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dignore.endorsed.dirs=
13-Aug-2018 18:22:12.833 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dcatalina.base=/usr/local/tomee
13-Aug-2018 18:22:12.833 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dcatalina.home=/usr/local/tomee
13-Aug-2018 18:22:12.834 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Djava.io.tmpdir=/usr/local/tomee/temp
13-Aug-2018 18:22:12.834 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
13-Aug-2018 18:22:12.934 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Initializing ProtocolHandler ["http-nio-8084"]
13-Aug-2018 18:22:12.953 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Using a shared selector for servlet write/read
13-Aug-2018 18:22:12.963 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Initializing ProtocolHandler ["ajp-nio-8009"]
13-Aug-2018 18:22:12.968 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Using a shared selector for servlet write/read
13-Aug-2018 18:22:13.487 INFO [main] org.apache.openejb.util.OptionsLog.info Using 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
13-Aug-2018 18:22:13.609 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> ********************************************************************************
13-Aug-2018 18:22:13.609 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> OpenEJB http://tomee.apache.org/
13-Aug-2018 18:22:13.609 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> Startup: Mon Aug 13 18:22:13 UTC 2018
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> Copyright 1999-2018 (C) Apache OpenEJB Project, All Rights Reserved.
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> Version: 7.0.5
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> Build date: 20180710
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> Build time: 12:28
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> ********************************************************************************
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> openejb.home = /usr/local/tomee
13-Aug-2018 18:22:13.610 INFO [main] org.apache.openejb.OpenEJB$Instance.<init> openejb.base = /usr/local/tomee
13-Aug-2018 18:22:13.614 INFO [main] org.apache.openejb.cdi.CdiBuilder.initializeOWB Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl#42721fe
13-Aug-2018 18:22:13.615 INFO [main] org.apache.openejb.cdi.CdiBuilder.initializeOWB Succeeded in installing singleton service
13-Aug-2018 18:22:13.661 INFO [main] org.apache.openejb.config.ConfigurationFactory.init TomEE configuration file is '/usr/local/tomee/conf/tomee.xml'
13-Aug-2018 18:22:13.715 INFO [main] org.apache.openejb.config.ConfigurationFactory.configureService Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
13-Aug-2018 18:22:13.718 INFO [main] org.apache.openejb.config.ConfigurationFactory.configureService Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
13-Aug-2018 18:22:13.722 INFO [main] org.apache.openejb.util.OptionsLog.info Using 'openejb.deployments.classpath=false'
13-Aug-2018 18:22:13.726 INFO [main] org.apache.openejb.assembler.classic.Assembler.createRecipe Creating TransactionManager(id=Default Transaction Manager)
13-Aug-2018 18:22:13.791 INFO [main] org.apache.openejb.assembler.classic.Assembler.createRecipe Creating SecurityService(id=Tomcat Security Service)
13-Aug-2018 18:22:13.882 INFO [main] org.apache.openejb.server.ServiceManager.initServer Creating ServerService(id=cxf)
13-Aug-2018 18:22:14.094 INFO [main] org.apache.openejb.server.ServiceManager.initServer Creating ServerService(id=cxf-rs)
13-Aug-2018 18:22:14.167 INFO [main] org.apache.openejb.server.SimpleServiceManager.start ** Bound Services **
13-Aug-2018 18:22:14.168 INFO [main] org.apache.openejb.server.SimpleServiceManager.printRow NAME IP PORT
13-Aug-2018 18:22:14.168 INFO [main] org.apache.openejb.server.SimpleServiceManager.start -------
13-Aug-2018 18:22:14.168 INFO [main] org.apache.openejb.server.SimpleServiceManager.start Ready!
13-Aug-2018 18:22:14.170 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Initialization processed in 1926 ms
13-Aug-2018 18:22:14.241 INFO [main] org.apache.tomee.catalina.OpenEJBNamingContextListener.bindResource Importing a Tomcat Resource with id 'UserDatabase' of type 'org.apache.catalina.UserDatabase'.
13-Aug-2018 18:22:14.241 INFO [main] org.apache.openejb.assembler.classic.Assembler.createRecipe Creating Resource(id=UserDatabase)
13-Aug-2018 18:22:14.246 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Starting service [Catalina]
13-Aug-2018 18:22:14.247 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Starting Servlet Engine: Apache Tomcat (TomEE)/8.5.32 (7.0.5)
13-Aug-2018 18:22:14.267 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deploying web application directory [/usr/local/tomee/webapps/manager]
13-Aug-2018 18:22:14.285 INFO [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.init ------------------------- localhost -> /manager
13-Aug-2018 18:22:14.623 INFO [localhost-startStop-1] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: /usr/local/tomee/webapps/manager
13-Aug-2018 18:22:14.692 INFO [localhost-startStop-1] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "/usr/local/tomee/webapps/manager" loaded.
13-Aug-2018 18:22:14.702 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: /usr/local/tomee/webapps/manager
13-Aug-2018 18:22:14.783 INFO [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps using context file /usr/local/tomee/webapps/manager/META-INF/context.xml
13-Aug-2018 18:22:14.787 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/usr/local/tomee/webapps/manager)
13-Aug-2018 18:22:14.984 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
13-Aug-2018 18:22:15.125 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory [/usr/local/tomee/webapps/manager] has finished in [858] ms
13-Aug-2018 18:22:15.126 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deploying web application directory [/usr/local/tomee/webapps/docs]
13-Aug-2018 18:22:15.127 INFO [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.init ------------------------- localhost -> /docs
13-Aug-2018 18:22:15.177 INFO [localhost-startStop-1] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: /usr/local/tomee/webapps/docs
13-Aug-2018 18:22:15.184 INFO [localhost-startStop-1] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "/usr/local/tomee/webapps/docs" loaded.
13-Aug-2018 18:22:15.185 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: /usr/local/tomee/webapps/docs
13-Aug-2018 18:22:15.196 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/usr/local/tomee/webapps/docs)
13-Aug-2018 18:22:15.262 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
13-Aug-2018 18:22:15.283 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory [/usr/local/tomee/webapps/docs] has finished in [157] ms
13-Aug-2018 18:22:15.284 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deploying web application directory [/usr/local/tomee/webapps/ROOT]
13-Aug-2018 18:22:15.285 INFO [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.init ------------------------- localhost -> /
13-Aug-2018 18:22:15.327 INFO [localhost-startStop-1] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: /usr/local/tomee/webapps/ROOT
13-Aug-2018 18:22:15.341 INFO [localhost-startStop-1] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "/usr/local/tomee/webapps/ROOT" loaded.
13-Aug-2018 18:22:15.342 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: /usr/local/tomee/webapps/ROOT
13-Aug-2018 18:22:15.360 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/usr/local/tomee/webapps/ROOT)
13-Aug-2018 18:22:15.460 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
13-Aug-2018 18:22:15.496 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory [/usr/local/tomee/webapps/ROOT] has finished in [213] ms
13-Aug-2018 18:22:15.497 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deploying web application directory [/usr/local/tomee/webapps/host-manager]
13-Aug-2018 18:22:15.503 INFO [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.init ------------------------- localhost -> /host-manager
13-Aug-2018 18:22:15.552 INFO [localhost-startStop-1] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: /usr/local/tomee/webapps/host-manager
13-Aug-2018 18:22:15.568 INFO [localhost-startStop-1] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "/usr/local/tomee/webapps/host-manager" loaded.
13-Aug-2018 18:22:15.569 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: /usr/local/tomee/webapps/host-manager
13-Aug-2018 18:22:15.580 INFO [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps using context file /usr/local/tomee/webapps/host-manager/META-INF/context.xml
13-Aug-2018 18:22:15.581 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/usr/local/tomee/webapps/host-manager)
13-Aug-2018 18:22:15.632 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
13-Aug-2018 18:22:15.650 INFO [localhost-startStop-1] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory [/usr/local/tomee/webapps/host-manager] has finished in [154] ms
13-Aug-2018 18:22:15.658 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler ["http-nio-8084"]
13-Aug-2018 18:22:15.682 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler ["ajp-nio-8009"]
13-Aug-2018 18:22:15.699 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Server startup in 1527 ms
(7)
open tomee console in browser: http://localhost:8888

SonarQube in Docker failes to resolve local host

I'm attempting to set up SonarQube in Docker using an Alpine Linux Docker Image. However, when running the image, SonarQube seems to have problem resolving local host. Has anyone experienced this issue before?
Help with this issue would be greatly appreciated!
Dockerfile
FROM gliderlabs/alpine:3.2
ENV SONAR_VERSION=5.6.1 \
SONARQUBE_HOME=/opt/sonarqube \
SONARQUBE_FORCE_AUTHENTICATION=true \
# Database configuration
# Defaults to using H2
SONARQUBE_JDBC_USERNAME=sonar \
SONARQUBE_JDBC_PASSWORD=sonar \
SONARQUBE_JDBC_URL=
# Http port
EXPOSE 9000
RUN apk -Uu add gnupg curl \
&& rm -rf /var/cache/apk/*
# pub 2048R/D26468DE 2015-05-25
# Key fingerprint = F118 2E81 C792 9289 21DB CAB4 CFCA 4A29 D264 68DE
# uid sonarsource_deployer (Sonarsource Deployer) <infra#sonarsource.com>
# sub 2048R/06855C1D 2015-05-25
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE
RUN set -x \
&& mkdir /opt \
&& cd /opt \
&& curl -o sonarqube.zip -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip \
&& curl -o sonarqube.zip.asc -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip.asc \
&& gpg --batch --verify sonarqube.zip.asc sonarqube.zip \
&& unzip sonarqube.zip \
&& mv sonarqube-$SONAR_VERSION sonarqube \
&& rm sonarqube.zip* \
&& rm -rf $SONARQUBE_HOME/bin/*
VOLUME ["$SONARQUBE_HOME/data", "$SONARQUBE_HOME/extensions"]
WORKDIR $SONARQUBE_HOME
COPY run.sh $SONARQUBE_HOME/bin/
ENTRYPOINT ["./bin/run.sh"]
./bin/run.sh
#!/bin/sh
set -e
if [ "${1:0:1}" != '-' ]; then
exec "$#"
fi
exec java -jar lib/sonar-application-$SONAR_VERSION.jar \
-Dsonar.log.console=true \
-Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \
-Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \
-Dsonar.jdbc.url="$SONARQUBE_JDBC_URL" \
-Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS -Djava.security.egd=file:/dev/./urandom" \
"$#"
Docker log
016.08.31 07:56:45 INFO es[o.s.p.ProcessEntryPoint] Starting es
2016.08.31 07:56:45 INFO es[o.s.s.EsSettings] Elasticsearch listening on 127.0.0.1:9001
2016.08.31 07:56:45 INFO es[o.elasticsearch.node] [sonar-1472630204100] version[1.7.5], pid[18], build[00f95f4/2016-02-02T09:55:30Z]
2016.08.31 07:56:45 INFO es[o.elasticsearch.node] [sonar-1472630204100] initializing ...
2016.08.31 07:56:45 INFO es[o.e.plugins] [sonar-1472630204100] loaded [], sites []
2016.08.31 07:56:45 INFO es[o.elasticsearch.env] [sonar-1472630204100] using [1] data paths, mounts [[/opt/sonarqube/data (/dev/vda2)]], net usable_space [55gb], net total_space [59gb], types [ext4]
2016.08.31 07:56:46 WARN es[o.e.bootstrap] JNA not found. native methods will be disabled.
2016.08.31 07:56:47 INFO es[o.elasticsearch.node] [sonar-1472630204100] initialized
2016.08.31 07:56:47 INFO es[o.elasticsearch.node] [sonar-1472630204100] starting ...
2016.08.31 07:56:47 WARN es[o.e.common.network] failed to resolve local host, fallback to loopback
java.net.UnknownHostException: 05ae620efc22: 05ae620efc22: unknown error
at java.net.InetAddress.getLocalHost(InetAddress.java:1505) ~[na:1.8.0_72]
at org.elasticsearch.common.network.NetworkUtils.<clinit>(NetworkUtils.java:55) ~[elasticsearch-1.7.5.jar:na]
at org.elasticsearch.transport.netty.NettyTransport.createClientBootstrap(NettyTransport.java:350) [elasticsearch-1.7.5.jar:na]
at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:242) [elasticsearch-1.7.5.jar:na]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) [elasticsearch-1.7.5.jar:na]
at org.elasticsearch.transport.TransportService.doStart(TransportService.java:153) [elasticsearch-1.7.5.jar:na]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) [elasticsearch-1.7.5.jar:na]
at org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:257) [elasticsearch-1.7.5.jar:na]
at org.sonar.search.SearchServer.start(SearchServer.java:46) [sonar-search-5.6.1.jar:na]
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) [sonar-process-5.6.1.jar:na]
at org.sonar.search.SearchServer.main(SearchServer.java:81) [sonar-search-5.6.1.jar:na]
Caused by: java.net.UnknownHostException: 05ae620efc22: unknown error
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_72]
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_72]
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_72]
at java.net.InetAddress.getLocalHost(InetAddress.java:1500) ~[na:1.8.0_72]
... 10 common frames omitted
May be there is no Name Service Switch file in Alpine linux, and java need one for java.net.InetAddress.getLocalHost for example.
Add this line in dockerfile
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' > /etc/nsswitch.conf
Since InetAddress.html#getLocalHost will "retrieving the name of the host from the system", make sure you launch your container with an hostname.
docker run --add-host xxx --hostname yyy
See docker run Network Settings for --add-host and --hostname options
I run into a same like issue on k8s and resolved by providing an environment variable to force the DB bind to 127.0.0.1
kubectl run sonarqube --image=sonarqube --port=9092 --env="SONARQUBE_WEB_JVM_OPTS=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dh2.bindAddress=127.0.0.1"

Resources