I am trying to run a custom java swing GUI using the docker toolbox in windows. I want to now containerize this application however getting following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
/opt/jdk1.8.0_202/jre
/lib/amd64/libawt_xawt.so: libXext.so.6: cannot open shared object file:
No such file or directory
I am running a dockerfile. The setup is:
1) Install Linux
2) Install JDK
3) Copy over the folder containing the JAR
4) run the docker container which would bring up the GUI ( not the linux front-end , not using a vnc is preferred).
I am using Xlaunch for the terminal on windows and am able to launch a firefox on docker using this.
This is the first docker file
FROM anapsix/alpine-java
COPY ./myJarFolder /home/myJarFolder
CMD ["java","-jar","/home/myJarFolder/myJarFile.jar"]
This is the second docker file
FROM alpine:3.2
MAINTAINER Anastas Dancha [...]
# Install cURL
RUN apk --no-cache add ca-certificates
# Java Version
ENV JAVA_VERSION_MAJOR 8
ENV JAVA_VERSION_MINOR 45
ENV JAVA_VERSION_BUILD 14
ENV JAVA_PACKAGE jdk
# Download and unarchive Java
RUN mkdir /opt && / curl -jksSLH "Cookie: oraclelicense=accept-securebackup-cookie" && / http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz | tar -xzf - -C /opt && / ln -s /opt/jdk1.${JAVA_VERSION_MAJOR}.0_${JAVA_VERSION_MINOR} /opt/jdk && / rm -rf /opt/jdk/*src.zip && /opt/jdk/lib/missioncontrol && /opt/jdk/lib/visualvm && /opt/jdk/lib/*javafx* && /opt/jdk/jre/lib/plugin.jar && /opt/jdk/jre/lib/ext/jfxrt.jar && /opt/jdk/jre/bin/javaws && /opt/jdk/jre/lib/javaws.jar && /opt/jdk/jre/lib/desktop && /opt/jdk/jre/plugin && /opt/jdk/jre/lib/deploy* && /opt/jdk/jre/lib/*javafx* && /opt/jdk/jre/lib/*jfx* && /opt/jdk/jre/lib/amd64/libdecora_sse.so && /opt/jdk/jre/lib/amd64/libprism_*.so && /opt/jdk/jre/lib/amd64/libfxplugins.so && /opt/jdk/jre/lib/amd64/libglass.so && /opt/jdk/jre/lib/amd64/libgstreamer-lite.so && /opt/jdk/jre/lib/amd64/libjavafx*.so && /opt/jdk/jre/lib/amd64/libjfx*.so
# Set environment
ENV JAVA_HOME /opt/jdk
ENV PATH ${PATH}:${JAVA_HOME}/bin
# COPY myJarFolder from local repository to the image
COPY ./myJarFolder /usr/local/myJarFolder
# Start the image with the jar file as the entrypoint
ENTRYPOINT ["java", "-jar", "usr/local/myJarFolder/myJarFile.jar"]
# EOF
I am getting this error with the first dockerfile
$ docker run -ti --rm -e DISPLAY=10.193.146.124:0.0 myDocker:1.0 Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/jdk1.8.0_202/jre /lib/amd64/libawt_xawt.so: libXext.so.6: cannot open shared object file: No such file or directory at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1086) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at java.awt.Toolkit$3.run(Toolkit.java:1636) at java.awt.Toolkit$3.run(Toolkit.java:1634) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.loadLibraries(Toolkit.java:1633) at java.awt.Toolkit.(Toolkit.java:1670) at java.awt.Component.(Component.java:593) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa der.java:56)
I am getting permission error with the second dockerfile at mkdir /opt line.
Can someone please let me know the correct way of doing it in windows.
ubuntu:18.04
. – valiano