Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Add RUN_FLUXBOX and RUN_XTERM variables
Browse files Browse the repository at this point in the history
  • Loading branch information
theasp authored and Andrew Phillips committed May 24, 2017
1 parent 2230672 commit 22e1c59
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 21 deletions.
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
FROM debian:stretch

# Setup demo environment variables
ENV HOME=/root \
DEBIAN_FRONTEND=noninteractive \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
DISPLAY=:0.0 \
DISPLAY_WIDTH=1024 \
DISPLAY_HEIGHT=768

# Install git, supervisor, VNC, & X11 packages
RUN set -ex; \
apt-get update; \
Expand All @@ -25,7 +15,17 @@ RUN set -ex; \
xterm \
xvfb

# Setup demo environment variables
ENV HOME=/root \
DEBIAN_FRONTEND=noninteractive \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
DISPLAY=:0.0 \
DISPLAY_WIDTH=1024 \
DISPLAY_HEIGHT=768 \
RUN_XTERM=yes \
RUN_FLUXBOX=yes
COPY . /app

CMD ["/usr/bin/supervisord", "-c", "/app/supervisord.conf"]
CMD ["/app/entrypoint.sh"]
EXPOSE 8080
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,32 @@
This image is intended to be used for displaying X11 applications from other containers in a browser. A stand-alone demo as well as a [Version 2](https://docs.docker.com/compose/compose-file/#version-2) composition.

## Image Contents
___

* [Xvfb](http://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) - X11 in a virtual framebuffer
* [x11vnc](http://www.karlrunge.com/x11vnc/) - A VNC server that scrapes the above X11 server
* [noNVC](https://kanaka.github.io/noVNC/) - A HTML5 canvas vnc viewer
* [Fluxbox](http://www.fluxbox.org/) - a small window manager
* [socat](http://www.dest-unreach.org/socat/) - for use with other containers
* [xterm](http://invisible-island.net/xterm/) - to demo that it works
* [supervisord](http://supervisord.org) - to keep it all running

## Usage
___

### Variables

You can specify the following variables:
* `DISPLAY_WIDTH=<width>` (1024)
* `DISPLAY_HEIGHT=<height>` (768)
* `RUN_XTERM={yes|no}` (yes)
* `RUN_FLUXBOX={yes|no}` (yes)

### Stand-alone Demo
*On Windows and OS X Only -*
Determine the Docker machine IP address:
```bash
$ docker-machine ip $(docker-machine active)
192.168.99.101
```
Run:
```bash
$ docker run --rm -it -p 8080:8080 theasp/novnc
```
Open a browser and hit the *Connect* button to see the `xterm` demo at `http://<DOCKER_MACHINE_IP>:8080/vnc.html`
Open a browser and see the `xterm` demo at `http://<server>:8080/vnc.html`

### V2 Composition
A version of the [V2 docker-compose example](https://github.com/theasp/docker/blob/master/docker-compose.yml) is shown below to illustrate how this image can be used to greatly simplify the use of X11 applications in other containers. With just `docker-compose up -d`, your favorite IDE can be accessed via a browser.

Expand Down Expand Up @@ -61,6 +65,7 @@ networks:
x11:
```
**If the IDE fails to start simply run `docker-compose restart <container-name>`.**

## On DockerHub / GitHub
___
* DockerHub [theasp/novnc](https://hub.docker.com/r/theasp/novnc/)
Expand Down
19 changes: 19 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -ex

RUN_FLUXBOX=${RUN_FLUXBOX:-yes}
RUN_XTERM=${RUN_XTERM:-yes}

case $RUN_FLUXBOX in
false|no|n|0)
rm -f /app/conf.d/fluxbox.conf
;;
esac

case $RUN_XTERM in
false|no|n|0)
rm -f /app/conf.d/xterm.conf
;;
esac

exec supervisord -c /app/supervisord.conf

0 comments on commit 22e1c59

Please sign in to comment.