Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Docs and a couple tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrehm committed Sep 11, 2014
1 parent d3fb4a7 commit a7935ec
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ RUN wget http://download.netbeans.org/netbeans/8.0.1/final/bundles/netbeans-8.0.
/tmp/netbeans.sh --silent --state /tmp/state.xml && \
rm -rf /tmp/*

RUN mkdir -p /home/developer && \
ADD run /usr/local/bin/netbeans

RUN chmod +x /usr/local/bin/netbeans && \
mkdir -p /home/developer && \
echo "developer:x:1000:1000:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:1000:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
Expand All @@ -28,4 +31,4 @@ RUN mkdir -p /home/developer && \
USER developer
ENV HOME /home/developer
WORKDIR /home/developer
CMD /usr/local/netbeans-8.0.1/bin/netbeans
CMD /usr/local/bin/netbeans
53 changes: 50 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
docker-netbeans
===============
# docker-netbeans

NetBeans v8.0.1 in a container
NetBeans v8.0.1 in a Docker container

## Requirements

* Docker 1.2+ (should work fine on 1.0+ but I haven't tried)
* An X11 socket

## Quickstart

Assuming `$HOME/bin` is on your `PATH` and that you are able to run `docker`
commands [without `sudo`](http://docs.docker.io/installation/ubuntulinux/#giving-non-root-access),
you can use the [provided `netbeans` script](netbeans) to start a disposable
NetBeans Docker container with your project sources mounted at `/home/developer/workspace`
within the container:

```sh
# The image size is currently 1.131 GB, so go grab a coffee while Docker downloads it
docker pull fgrehm/netbeans:v8.0.1
L=$HOME/bin/netbeans && curl -sL https://github.com/fgrehm/docker-netbeans/raw/master/netbeans > $L && chmod +x $L
cd /path/to/java/project
netbeans
```

Once you close NetBeans the container will be removed and no traces of it will be
kept on your machine (apart from the Docker image of course).

## Making plugins persist between sessions

NetBeans plugins are kept on `$HOME/.netbeans` inside the container, so if you
want to keep them around after you close it, you'll need to share it with your
host.

For example:

```sh
docker run -ti --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v `pwd`/.netbeans-docker:/home/developer/.netbeans \
-v `pwd`:/workspace \
fgrehm/netbeans:v8.0.1
```

## Help! I started the container but I don't see the NetBeans screen

You might have an issue with the X11 socket permissions since the default user
used by the base image has an user and group ids set to `1000`, in that case
you can run either create your own base image with the appropriate ids or run
`xhost +` on your machine and try again.
2 changes: 1 addition & 1 deletion netbeans
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
docker run -ti --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v `pwd`:/home/developer/workspace \
-v `pwd`:/workspace \
fgrehm/netbeans:v8.0.1
7 changes: 7 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Make sure the user data directory is owned by the developer user
if [ -d /home/developer/.netbeans ]; then
sudo chown developer:developer /home/developer/.netbeans
fi
exec /usr/local/netbeans-8.0.1/bin/netbeans

0 comments on commit a7935ec

Please sign in to comment.