Docker Community Forums

Share and learn in the Docker community.

Can not build container from a commit image


(Maitarek) #1

After Committing the openfire container into an image and use this image to build new container, this container not started and gave this Exception

Starting openfire…
Exception in thread “main” java.lang.NoClassDefFoundError: org/jivesoftware/util/Log
at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:96)
at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:56)
Caused by: java.lang.ClassNotFoundException: org.jivesoftware.util.Log
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)


(Ranjandas) #2

Hi,

Can you share the command you are using to launch openfire in docker. It will be good if you can share the Dockerfile you are using. The error you are seeing is somewhat related to missing classpath.

Regards


(Maitarek) #3

Here is the Dockerfile
/////////////////////////////////////////////
FROM sameersbn/ubuntu:14.04.20150613

ENV OPENFIRE_VERSION 3.10.2
RUN apt-get update
&& apt-get install -y openjdk-7-jre wget
&& wget "http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_${OPENFIRE_VERSION}all.deb"
-O /tmp/openfire
${OPENFIRE_VERSION}all.deb
&& dpkg -i /tmp/openfire
${OPENFIRE_VERSION}all.deb
&& rm -rf openfire
${OPENFIRE_VERSION}_all.deb
&& rm -rf /var/lib/apt/lists/* # 20150613

ADD start /start
RUN chmod 755 /start

EXPOSE 3478
EXPOSE 3479
EXPOSE 5222
EXPOSE 5223
EXPOSE 5229
EXPOSE 7070
EXPOSE 7443
EXPOSE 7777
EXPOSE 9090
EXPOSE 9091
EXPOSE 5701
EXPOSE 5702

VOLUME ["/data"]
CMD ["/start"]
//////////////////////////////////////////////////////

and Here is the start script:
///////////////////////////////////////////////////////
#!/bin/bash

set -e

chmod 775 /data

mkdir -p /data/openfire
chown -R openfire:openfire /data/openfire

populate default openfire configuration if it does not exist

if [ ! -d /data/openfire/etc ]; then
mv /etc/openfire /data/openfire/etc
fi
rm -rf /etc/openfire
ln -sf /data/openfire/etc /etc/openfire

if [ ! -d /data/openfire/lib ]; then
mv /var/lib/openfire /data/openfire/lib
fi
rm -rf /var/lib/openfire
ln -sf /data/openfire/lib /var/lib/openfire

echo "Starting openfire…"
exec gosu openfire /usr/bin/java
-server
-DopenfireHome=/usr/share/openfire
-Dopenfire.lib.dir=/usr/share/openfire/lib
-classpath /usr/share/openfire/lib/startup.jar
-jar /usr/share/openfire/lib/startup.jar
//////////////////////////////////////////////////////


(Ranjandas) #4

Hi,

I used your Dockerfile and the start script and for me its working perfectly fine. I could also connect the openfire web-ui.

Ranjans-MBP:openfire ranjan$ ls -l
total 16
-rw-r--r--  1 athiyara  wheel  729 29 Sep 20:38 Dockerfile
-rw-r--r--  1 athiyara  wheel  637 29 Sep 20:38 start
Ranjans-MBP:openfire ranjan$ docker build -t openfire .
Sending build context to Docker daemon 4.096 kB
Step 0 : FROM sameersbn/ubuntu:14.04.20150613
 ---> 7a6ee8ea2bf2
Step 1 : ENV OPENFIRE_VERSION 3.10.2
 ---> Using cache
 ---> a2c0ca9d1223
Step 2 : RUN sed -i 's/archive.ubuntu.com/mirror.optus.net/g' /etc/apt/sources.list
 ---> Using cache
 ---> 74208737ae08
Step 3 : RUN apt-get update && apt-get install -y openjdk-7-jre wget && wget "http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_${OPENFIRE_VERSION}_all.deb" -O /tmp/openfire_${OPENFIRE_VERSION}_all.deb && dpkg -i /tmp/openfire_${OPENFIRE_VERSION}_all.deb && rm -rf openfire_${OPENFIRE_VERSION}_all.deb && rm -rf /var/lib/apt/lists/* # 20150613
 ---> Using cache
 ---> d9400e3a35ba
Step 4 : ADD start /start
 ---> Using cache
 ---> d5ac921b2965
Step 5 : RUN chmod 755 /start
 ---> Using cache
 ---> 48da74ee572e
Step 6 : EXPOSE 3478
 ---> Using cache
 ---> 21f145070331
Step 7 : EXPOSE 3479
 ---> Using cache
 ---> ee4111f2de7b
Step 8 : EXPOSE 5222
 ---> Using cache
 ---> f42c53eaf0c8
Step 9 : EXPOSE 5223
 ---> Using cache
 ---> 66e15e8be39b
Step 10 : EXPOSE 5229
 ---> Using cache
 ---> 83e0e2bfd1d7
Step 11 : EXPOSE 7070
 ---> Using cache
 ---> a5f6d0be0938
Step 12 : EXPOSE 7443
 ---> Using cache
 ---> 245846e22d26
Step 13 : EXPOSE 7777
 ---> Using cache
 ---> 37b9734ae890
Step 14 : EXPOSE 9090
 ---> Using cache
 ---> ac06d195c438
Step 15 : EXPOSE 9091
 ---> Using cache
 ---> 493145a0332e
Step 16 : EXPOSE 5701
 ---> Using cache
 ---> 9e01a886b035
Step 17 : EXPOSE 5702
 ---> Using cache
 ---> b4a88504dcdd
Step 18 : VOLUME /data
 ---> Using cache
 ---> 21ecdfcd4de3
Step 19 : CMD /start
 ---> Using cache
 ---> 4521b6bcbfc7
Successfully built 4521b6bcbfc7
Ranjans-MBP:openfire ranjan$ docker run -it --rm -p 9090:9090 openfire
Starting openfire...
Openfire 3.10.2 [Sep 29, 2015 11:18:38 AM]
Admin console listening at http://f11e9c29434e:9090

I wonder why you are getting an error. Can you try once again.

Regards


(Maitarek) #5

Yes, and with me too it is working fine.
but after committing it into a new image and build a new container from the new image, i get the error above.
Can you try to commit it and use the new image?

Thanks