Public | Automated Build

Last pushed: a month ago
Short Description
Java 8 (1.8.0_141) JDK + Maven 3.5.0 + Python 2.7.12
Full Description

Java 8 (1.8.0_141) JRE server + Maven 3.5.0 + Python 2.7.12

Components:

  • Oracle Java "1.8.0_141" JRE Runtime Environment for Server
    Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
  • Apache Maven 3.5.0
    Maven home: /usr/apache-maven-3.5.0
  • Python 2.7.12
  • Other tools: git wget unzip vim python python-setuptools python-dev python-numpy

Pull the image from Docker Repository

docker pull openkbs/jre-mvn-py

Base the image to build add-on components

FROM openkbs/jre-mvn-py

Run the image

Then, you're ready to run :
Make sure you create your work directory, e.g., /data

mkdir ./data
docker run -d --name my-jre-mvn-py -v $PWD/data:/data -i -t openkbs/jre-mvn-py

Build and Run your own image

Say, you will build the image "my/jre-mvn-py".

docker build -t my/jre-mvn-py .

To run your own image, say, with some-jre-mvn-py:

mkdir ./data
docker run -d --name some-jre-mvn-py -v $PWD/data:/data -i -t my/jre-mvn-py

Shell into the Docker instance

docker exec -it some-jre-mvn-py /bin/bash

Run Python code

To run Python code

docker run --rm openkbs/jre-mvn-py python -c 'print("Hello World")'

or,

docker run -i --rm openkbs/jre-mvn-py python < myPyScript.py

or,

mkdir ./data
echo "print('Hello World')" > ./data/myPyScript.py
docker run -it --rm --name some-jre-mvn-py -v "$PWD"/data:/data openkbs/jre-mvn-py python myPyScript.py

or,

alias dpy='docker run --rm openkbs/jre-mvn-py python'
dpy -c 'print("Hello World")'

Compile or Run java while no local installation needed

Remember, the default working directory, /data, inside the docker container -- treat is as "/".
So, if you create subdirectory, "./data/workspace", in the host machine and
the docker container will have it as "/data/workspace".

#!/bin/bash -x
mkdir ./data
cat >./data/HelloWorld.java <<-EOF
public class HelloWorld {
   public static void main(String[] args) {
      System.out.println("Hello, World");
   }
}
EOF
cat ./data/HelloWorld.java
alias djavac='docker run -it --rm --name some-jre-mvn-py3 -v '$PWD'/data:/data openkbs/jre-mvn-py3 javac'
alias djava='docker run -it --rm --name some-jre-mvn-py3 -v '$PWD'/data:/data openkbs/jre-mvn-py3 java'

djavac HelloWorld.java
djava HelloWorld

And, the output:

Hello, World

Hence, the alias above, "djavac" and "djava" is your docker-based "javac" and "java" commands and
it will work the same way as your local installed Java's "javac" and "java" commands.
However, for larger complex projects, you might want to consider to use Docker-based IDE.
For example, try this docker-scala-ide:
Scala IDE in Docker
See also,
Java Development in Docker

Docker Pull Command
Owner
openkbs
Source Repository

Comments (0)