├── .dockerignore ├── Dockerfile ├── LICENSE ├── README.md ├── build ├── netbeans ├── run └── state.xml /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | MAINTAINER Fabio Rehm "fgrehm@gmail.com" 3 | 4 | RUN sed 's/main$/main universe/' -i /etc/apt/sources.list && \ 5 | apt-get update && apt-get install -y software-properties-common && \ 6 | add-apt-repository ppa:webupd8team/java -y && \ 7 | apt-get update && \ 8 | echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ 9 | apt-get install -y oracle-java8-installer libxext-dev libxrender-dev libxtst-dev && \ 10 | apt-get clean && \ 11 | rm -rf /var/lib/apt/lists/* && \ 12 | rm -rf /tmp/* 13 | 14 | ADD state.xml /tmp/state.xml 15 | 16 | RUN wget http://download.netbeans.org/netbeans/8.0.1/final/bundles/netbeans-8.0.1-javase-linux.sh -O /tmp/netbeans.sh -q && \ 17 | chmod +x /tmp/netbeans.sh && \ 18 | echo 'Installing netbeans' && \ 19 | /tmp/netbeans.sh --silent --state /tmp/state.xml && \ 20 | rm -rf /tmp/* 21 | 22 | ADD run /usr/local/bin/netbeans 23 | 24 | RUN chmod +x /usr/local/bin/netbeans && \ 25 | mkdir -p /home/developer && \ 26 | echo "developer:x:1000:1000:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ 27 | echo "developer:x:1000:" >> /etc/group && \ 28 | echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ 29 | chmod 0440 /etc/sudoers.d/developer && \ 30 | chown developer:developer -R /home/developer 31 | 32 | USER developer 33 | ENV HOME /home/developer 34 | WORKDIR /home/developer 35 | CMD /usr/local/bin/netbeans 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Fabio Rehm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-netbeans 2 | 3 | NetBeans v8.0.1 in a Docker container 4 | 5 | ## Requirements 6 | 7 | * Docker 1.2+ (should work fine on 1.0+ but I haven't tried) 8 | * An X11 socket 9 | 10 | ## Quickstart 11 | 12 | Assuming `$HOME/bin` is on your `PATH` and that you are able to run `docker` 13 | commands [without `sudo`](http://docs.docker.io/installation/ubuntulinux/#giving-non-root-access), 14 | you can use the [provided `netbeans` script](netbeans) to start a disposable 15 | NetBeans Docker container with your project sources mounted at `/home/developer/workspace` 16 | within the container: 17 | 18 | ```sh 19 | # The image size is currently 1.131 GB, so go grab a coffee while Docker downloads it 20 | docker pull fgrehm/netbeans:v8.0.1 21 | L=$HOME/bin/netbeans && curl -sL https://github.com/fgrehm/docker-netbeans/raw/master/netbeans > $L && chmod +x $L 22 | cd /path/to/java/project 23 | netbeans 24 | ``` 25 | 26 | Once you close NetBeans the container will be removed and no traces of it will be 27 | kept on your machine (apart from the Docker image of course). 28 | 29 | ## Making plugins persist between sessions 30 | 31 | NetBeans plugins are kept on `$HOME/.netbeans` inside the container, so if you 32 | want to keep them around after you close it, you'll need to share it with your 33 | host. 34 | 35 | For example: 36 | 37 | ```sh 38 | docker run -ti --rm \ 39 | -e DISPLAY=$DISPLAY \ 40 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 41 | -v `pwd`/.netbeans-docker:/home/developer/.netbeans \ 42 | -v `pwd`:/workspace \ 43 | fgrehm/netbeans:v8.0.1 44 | ``` 45 | 46 | ## Help! I started the container but I don't see the NetBeans screen 47 | 48 | You might have an issue with the X11 socket permissions since the default user 49 | used by the base image has an user and group ids set to `1000`, in that case 50 | you can run either create your own base image with the appropriate ids or run 51 | `xhost +` on your machine and try again. 52 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | echo 'This will take a lot of time...' 2 | docker build -t fgrehm/netbeans:v8.0.1 . 3 | -------------------------------------------------------------------------------- /netbeans: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker run -ti --rm \ 4 | -e DISPLAY=$DISPLAY \ 5 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 6 | -v `pwd`:/workspace \ 7 | fgrehm/netbeans:v8.0.1 8 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure the user data directory is owned by the developer user 4 | if [ -d /home/developer/.netbeans ]; then 5 | sudo chown developer:developer /home/developer/.netbeans 6 | fi 7 | exec /usr/local/netbeans-8.0.1/bin/netbeans 8 | -------------------------------------------------------------------------------- /state.xml: -------------------------------------------------------------------------------- 1 | 39 | 40 | 41 | 42 | $N{install}/NetBeans 8.0.1 43 | 1.7.0 44 | /usr/lib/jvm/java-8-oracle 45 | 1410350717067 46 | all.users 47 | $N{install}/NetBeans/NetBeans/NetBeans 8.0.1.app 48 | /usr/local/netbeans-8.0.1 49 | all.users 50 | JUnit library successfully installed and all plugins are up to date. 51 | 52 | 53 | 54 | 55 | 56 | 57 | false 58 | /usr/local/netbeans-8.0.1 59 | 60 | 61 | 62 | 63 | false 64 | /usr/local/netbeans-8.0.1 65 | true 66 | 67 | 68 | 69 | 70 | --------------------------------------------------------------------------------