|
1 | 1 | # voxel-dockerclient |
2 | | -An experimental minecraft-like docker client, built using voxel.js. Inspired by [dockercraft](https://github.com/docker/dockercraft). |
| 2 | +An experimental Minecraft-like docker client, built using [voxel.js](http://voxeljs.com/). Inspired by [dockercraft](https://github.com/docker/dockercraft). |
| 3 | + |
| 4 | +## What is it? |
| 5 | +The @docker/dockercraft project turns the official Minecraft client into a docker client. voxel-dockerclient is a pure-javascript, browser-only docker client that provides a similar experiance. |
| 6 | + |
| 7 | +## What is it not? |
| 8 | +voxel-dockerclient is not a serious tool for working with docker. It's a fun project (which may grow up to be a teaching aid someday). |
| 9 | + |
| 10 | +## How to run voxel-dockerclient |
| 11 | +### Using the docker image |
| 12 | +The easiest way is to pull the docker image, and run from that. The steps are as follows: |
| 13 | +1. Pull the docker image with |
| 14 | + ``` |
| 15 | + docker pull rajchaudhuri/voxel-dockerclient |
| 16 | + ``` |
| 17 | +2. Run it with: |
| 18 | + ``` |
| 19 | + docker run --name vdc1 -p 5000:8080 -v /var/run/docker.sock:/var/run/docker.sock rajchaudhuri/voxel-dockerclient |
| 20 | + ``` |
| 21 | + The `-v /var/run/docker.sock:/var/run/docker.sock` is *very important*. This makes the UNIX socket, which the docker daemon |
| 22 | + listens to by default, available to the container. The container needs this to proxy a subset of the Docker remote API to |
| 23 | + voxel-dockerclient. If you leave this out by mistake, voxel-dockerclient will not work. |
| 24 | +3. Point your browser to the container. If you run docker directly on your Linux machine, browse to: `http://localhost:5000`. |
| 25 | + If you use docker-machine (for example, with the Docker Toolbox on Windows), find the IP address of your docker machine with |
| 26 | + ``` |
| 27 | + docker-machine ip default |
| 28 | + ``` |
| 29 | + and then browse to that IP address using the port that you mapped in step 2. E.g.: |
| 30 | + `http://192.17.22.1:5000` |
| 31 | +
|
| 32 | +### Running with node.js |
| 33 | +Alternatively, if you have node.js installed on your docker host, you can clone the github repository, and run voxel-dockerclient yourself. The steps are: |
| 34 | +1. Clone the github repository with |
| 35 | + ``` |
| 36 | + git clone https://github.com/rajch/voxel-dockerclient.git |
| 37 | + ``` |
| 38 | +2. Run |
| 39 | + ``` |
| 40 | + npm install |
| 41 | + ``` |
| 42 | +3. Run |
| 43 | + ``` |
| 44 | + npm start |
| 45 | + ``` |
| 46 | +4. Browse to `http://localhost:8080` |
| 47 | +
|
| 48 | +Your logged-in user needs to be a member of the `docker` group for this to work. |
| 49 | +
|
| 50 | +## How to use voxel-dockerclient |
| 51 | +This is the opening screen of voxel-dockerclient. |
| 52 | +
|
| 53 | + |
| 54 | +
|
| 55 | +Press the **\`** key to close the dialog. The same key can be used to open and close the command console, and to close any dialog. |
| 56 | +
|
| 57 | +At this point, you should see all your containers, arranged left to right from the oldest to the newest. Running or stopped is indicated by lights on the container. |
| 58 | +
|
| 59 | +Look around with your mouse. Move the player around with the WASD keys. The space bar makes the player jump. Double-tapping the space bar makes the player fly. |
| 60 | +
|
| 61 | +While flying, the space bar takes the player higher, and the shift key lower. Once the player hits the ground, running will start again. |
| 62 | +
|
| 63 | +Open the command console, and try the commands. Currently, the following commands are available: |
| 64 | + <table><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td>help</td><td>Shows all available commands</td></tr><tr><td>inspect</td><td>Inspects a container</td></tr><tr><td>top</td><td>Shows processes running in a container</td></tr><tr><td>start</td><td>Starts a container</td></tr><tr><td>stop</td><td>Stops a container</td></tr><tr><td>go</td><td>Takes player to a container, or to the first or last container. Type go home if you get lost.</td></tr><tr><td>remove</td><td>Deletes a container</td></tr><tr><td>create</td><td>Creates a container</td></tr><tr><td>welcome</td><td>Shows the welcome message</td></tr><tr><td>refresh</td><td>Re-fetches container list</td></tr><tr><td>restart</td><td>Restarts voxel-dockerclient. Use as a last resort.</td></tr></tbody></table> |
| 65 | +
|
| 66 | +Of these, the container-related commands like `start`, `stop`, `top`, `remove` and `inspect` can be invoked in two ways: either by using the `\<command\> \<containername\>` syntax, or by positioning the player exactly next to a container, and using just `\<command\>`. |
| 67 | +
|
| 68 | +When the command console is closed, pressing the **I** key will invoke the `inpect` command. If the player is exactly next to a container, that container will be inspected. |
| 69 | +
|
| 70 | +The `create` command allows you to create new containers. Currently, you can only use images already on your docker host. Image pulling will be added in a later release. |
| 71 | +
|
| 72 | +Activity performed in other clients, such as the official docker client, will not reflect automatically in voxel-dockerclient. Use the `refresh` command periodincally. |
| 73 | +
|
| 74 | +The `go` command can be used to teleport the player to a particular container, using the syntax `go \<containername\>`. `go home` will teleport to the first (oldest) container. `go nextslot` will teleport to the spot where the next new container will appear. |
| 75 | +
|
| 76 | +## Browser compatibility |
| 77 | +voxel-dockerclient has been tested using recent Chrome and Firefox browsers, on Linux and Windows. Regrettably (*I mean it. I actually like that old browser*), it does not work with Internet Explorer. |
| 78 | +
|
| 79 | +## What's next? |
| 80 | +I intend to add the following capabilities quickly: |
| 81 | +* `docker logs` equivalent |
| 82 | +* `docker attach` equivalent |
| 83 | +* `docker pull` equivalent |
| 84 | +* A better interface for the `create` command |
| 85 | +* *Some* security |
| 86 | +
|
| 87 | +In the pipeline, further down, are: |
| 88 | +* volumes |
| 89 | +* networks |
| 90 | +* image management, including building new images |
| 91 | +
|
| 92 | +I don't really know how far I want to take this. I do want voxel-dockerclient to be complete, but I want to keep it simple. I may turn it into a teaching tool eventually. |
| 93 | +
|
| 94 | +## How does it work? |
| 95 | +On the server, voxel-dockerclient uses [Express](http://expressjs.com/) and the excellent [dockerode](https://github.com/apocas/dockerode) node module to provide a proxy for a subset of the Docker remote API. |
| 96 | +
|
| 97 | +On the client, it uses the brilliant [voxeljs](http://voxeljs.com/) family of node modules to render the UI, and the [axios](https://github.com/mzabriskie/axios) node module to communicate with the proxied API. |
| 98 | +
|
| 99 | +I am using an older flavour of the main voxeljs module, voxel-engine. I had to fork it because of some incompatibilities with later modules. The original is [here](https://github.com/maxogden/voxel-engine), and my forked version [here](https://github.com/rajch/voxel-engine). |
| 100 | +The same treatment had to be given for a voxeljs plugin called voxel-keys. The original is [here](https://github.com/voxel/voxel-keys), and my fork [here](https://github.com/rajch/voxel-keys). |
| 101 | +
|
| 102 | +The code is open source, under the MIT license. I would love contribution, in the form of issue reporting, feature requests, pull requests, anything. |
| 103 | +
|
| 104 | +## Acknowledgements |
| 105 | +I would like to thank: |
| 106 | +* The fine folk of @docker, for Docker |
| 107 | +* The fine folk behind the voxeljs family of modules. @maxogden, @kumavis, @deathcap, @substack et al. These are really nice. |
| 108 | +* The authors of the dockerode and axios modules |
| 109 | +* My partner, Chitra Raghavan, for contributing the player model, testing, and bearing with me while I was building this |
0 commit comments