Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drsnowbird/ubuntu-bionic-jdk-mvn-py3-x11
ubuntu-bionic-jdk-mvn-py3-x11
https://github.com/drsnowbird/ubuntu-bionic-jdk-mvn-py3-x11
java jdk8 python3 ubuntu-bionic x11
Last synced: 7 days ago
JSON representation
ubuntu-bionic-jdk-mvn-py3-x11
- Host: GitHub
- URL: https://github.com/drsnowbird/ubuntu-bionic-jdk-mvn-py3-x11
- Owner: DrSnowbird
- License: apache-2.0
- Created: 2018-07-29T23:08:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-30T00:02:37.000Z (over 6 years ago)
- Last Synced: 2024-11-14T02:24:09.208Z (2 months ago)
- Topics: java, jdk8, python3, ubuntu-bionic, x11
- Language: Shell
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java 8 (1.8.0_181) JDK + Maven 3.5 + Python 3.5 + X11 (display GUI)
[![](https://images.microbadger.com/badges/image/openkbs/ubuntu-bionic-jdk-mvn-py3-x11.svg)](https://microbadger.com/images/openkbs/ubuntu-bionic-jdk-mvn-py3-x11 "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/openkbs/ubuntu-bionic-jdk-mvn-py3-x11.svg)](https://microbadger.com/images/openkbs/ubuntu-bionic-jdk-mvn-py3-x11 "Get your own version badge on microbadger.com")# Components
* java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
* Apache Maven 3.5.3
* Python 3.5.2
* X11 display desktop
* Other tools: git wget unzip vim python python-setuptools python-dev python-numpy# Pull the image from Docker Repository
```bash
docker pull openkbs/ubuntu-bionic-jdk-mvn-py3-x11
```# Base the image to build add-on components
```Dockerfile
FROM openkbs/ubuntu-bionic-jdk-mvn-py3-x11
```# Run the image
Then, you're ready to run:
- make sure you create your work directory, e.g., ./data```bash
mkdir ./data
docker run -d --name my-ubuntu-bionic-jdk-mvn-py3-x11 -v $PWD/data:/data -i -t openkbs/ubuntu-bionic-jdk-mvn-py3-x11
```# Build and Run your own image
Say, you will build the image "my/ubuntu-bionic-jdk-mvn-py3-x11".```bash
docker build -t my/ubuntu-bionic-jdk-mvn-py3-x11 .
```To run your own image, say, with some-ubuntu-bionic-jdk-mvn-py3-x11:
```bash
mkdir ./data
docker run -d --name some-ubuntu-bionic-jdk-mvn-py3-x11 -v $PWD/data:/data -i -t my/jdk-mvn-py3
```## Shell into the Docker instance
```bash
docker exec -it some-ubuntu-bionic-jdk-mvn-py3-x11 /bin/bash
```## Run Python code
To run Python code
```bash
docker run -it --rm openkbs/ubuntu-bionic-jdk-mvn-py3-x11 python3 -c 'print("Hello World")'
```or,
```bash
docker run -i --rm openkbs/ubuntu-bionic-jdk-mvn-py3-x11 python3 < myPyScript.py
```or,
```bash
mkdir ./data
echo "print('Hello World')" > ./data/myPyScript.py
docker run -it --rm --name some-ubuntu-bionic-jdk-mvn-py3-x11 -v "$PWD"/data:/data openkbs/ubuntu-bionic-jdk-mvn-py3-x11 python3 myPyScript.py
```or,
```bash
alias dpy3='docker run --rm openkbs/ubuntu-bionic-jdk-mvn-py3-x11 python3'
dpy3 -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".```java
#!/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-ubuntu-bionic-jdk-mvn-py3-x11 -v '$PWD'/data:/data openkbs/ubuntu-bionic-jdk-mvn-py3-x11 javac'
alias djava='docker run -it --rm --name some-ubuntu-bionic-jdk-mvn-py3-x11 -v '$PWD'/data:/data openkbs/ubuntu-bionic-jdk-mvn-py3-x11 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.# Other docker-based IDE
* [openkbs/eclipse-oxygen-docker](https://hub.docker.com/r/openkbs/eclipse-oxygen-docker/)
* [openkbs/netbeans](https://hub.docker.com/r/openkbs/netbeans/)
* [openkbs/scala-ide-docker](https://hub.docker.com/r/openkbs/scala-ide-docker/)
* [openkbs/pycharm-docker](https://hub.docker.com/r/openkbs/pycharm-docker/)
* [openkbs/webstorm-docker](https://hub.docker.com/r/openkbs/webstorm-docker/)
* [openkbs/intellj-docker](https://hub.docker.com/r/openkbs/intellij-docker/)# See also
* [Java Development in Docker](https://blog.giantswarm.io/getting-started-with-java-development-on-docker/)# Display X11 Issue
More resource in X11 display of Eclipse on your host machine's OS, please see
* [X11 Display problem](https://askubuntu.com/questions/871092/failed-to-connect-to-mir-failed-to-connect-to-server-socket-no-such-file-or-di)
* [X11 Display with Xhost](http://www.ethicalhackx.com/fix-gtk-warning-cannot-open-display/)# Other possible Issues
You might see the warning message in the launching xterm console like below, you can just ignore it. I googles around and some blogs just suggested to ignore since the IDE still functional ok.