Minecraft server Docker image

Note: this post was migrated from my old Tumblr-backed blog

For the last couple of weeks, I’ve been playing with Docker and it is really, really cool. The fact that I can run an application that’s completely encapsulated from the rest of the system with limited access to memory, CPU, the filesystem and other processes is damn cool.

For part of my learning process, I decided to create a Minecraft Server image and, boy, has it been a real learning process. I’ve wrestled with features in Docker that are published but not yet released in their apt repository. I’ve built dozens of images that were either incomplete or just didn’t work. It’s a completely different way of thinking about applications. I was familiar with chroot, but Docker only has similarities on its façade.

If you want to play with my Minecraft Server Docker image, you can run the following command after installing Docker:

$ docker run spikegrobstein/minecraft_server start-foreground

From there, you should be able to see what port it’s running on (via docker ps) and connect to it.

My image is missing a couple of features, but hopefully I’ll be able to work those out as I learn more about how Docker works. This is my todo list:

  • add the ability to customize RAM usage (currently it’s hard-coded at 512MB for the Minecraft server process)
  • add ability to start the Minecraft server in the background (like mcwrapper was built for) so one could do backups and asynchronous server commands

I’ve got the Dockerfile repository on GitHub if anyone wants to see how it was built or make changes and send me pull requests: