Skip to content

vulhub/java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Openjdk images

Supported tags and respective Dockerfile links

Usage

With Command Line

Get help message:

docker run -it --rm --name my-java vulhub/java:8u162-jdk java -version

Compile and run a java source code:

# compile
$ docker run -it --rm --name my-java -v `pwd`:/usr/src vulhub/java:8u162-jdk javac /usr/src/HelloWorld.java

# run
$ docker run -it --rm --name my-java -v `pwd`:/usr/src vulhub/java:8u162-jdk java -classpath /usr/src HelloWorld
> Hello World

With Jetty

You can use vulhub/java just as a base image:

FROM vulhub/java:8u162-jdk

RUN set -ex \
    && mkdir -p /opt/jetty \
    && wget -qO- http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.8.v20171121/jetty-distribution-9.4.8.v20171121.tar.gz | tar xz -C /opt/jetty --strip-components=1

EXPOSE 8080

WORKDIR /opt/jetty/demo-base

CMD ["java", "-jar", "../start.jar"]

Build and run jetty demo:

docker build -t vulhub/jetty:9.4.8 .
docker run -it --rm --name my-java -p 8080:8080 vulhub/jetty:9.4.8

License

View license information for the software contained in this image.