Since at least 1999, system administrators have been looking for ways to make Ops a more visual, exciting environment. As recently as April, dockerdoomd showed us how to kill containers using Doom as a Docker Engine user interface.
In today’s world, we wanted to focus more on building. Minecraft has emerged as the sandbox game of the decade, so we chose to use that as our visual interface to Docker. Based on the customizable, scriptable Minecraft server, cuberite, we built our interface based around the metaphor of shipping containers and showed the Minecraft demo at DockerCon EU 2015.
The server visualizes shipping containers, with their container id printed on the side. To start or stop a container, you go into the container and hit a switch.
You can even type Docker commands directly in Minecraft.
How to run the demo
Follow these steps to run the demo for yourself:
1. Install the Minecraft client. You’ll also need a Minecraft account.
2. Run the following commands:
docker pull gaetan/dockercraft
docker run -t -i -d -p 25565:25565 \
-v /var/run/docker.sock:/var/run/docker.sock \
--name dockercraft \
3. Create a container at the command line. You use any container, or just run:
docker run -itd ubuntu:14.04 /bin/sh
4. Open the Minecraft client and join the server using the 127.0.0.1 address if running locally on linux, or the address of the VM running the docker daemon if you are on Windows or OS X.
How we built it
We chose Cuberite because it allows you to script the your Minecraft server using Lua. It provides you with hooks that let you detect actions within the Minecraft environment, such as activating a lever or pushing a button. It also has an API that lets you control what’s happening on your server.
To control both the Docker Engine, using the Docker Remote API, and the server, we wrote a Go program running as a daemon. Lua doesn’t have threading, so this let us send a bunch of events through Lua without them stacking up. The Go daemon then sent commands to the Docker Engine using the Remote API. Currently, we support starting, stopping, and removing containers. When the command is run in Docker, the Go daemon sends the result back to the Cuberite server, which would change the color of the container based on its status, create a new one if the user created a container, and destroy it when the container is removed.
This is very much an alpha demo. We wanted to give you a taste of what this can do. You can get the code in our GitHub repo. We also are seeking contributors, so please submit issues and pull requests.
Learn More about Docker
- New to Docker? Try our 10 min online tutorial
- Share images, automate builds, and more with a free Docker Hub account
- Read the Docker 1.9 Release Notes
- Subscribe to Docker Weekly
- Register for upcoming Docker Online Meetups
- Attend upcoming Docker Meetups
- Start contributing to Docker