Docker + Minecraft = Dockercraft
Перейти к файлу
Dave Tucker 7d4fae4948 Remove checked in 'dockercraft' binary
This should never have been checked in

Signed-off-by: Dave Tucker <dt@docker.com>
2016-12-08 18:07:58 +00:00
Docker Remove remains of vendored Cuberite 2016-12-08 18:05:08 +00:00
config Remove remains of vendored Cuberite 2016-12-08 18:05:08 +00:00
docs update dockercraft logo 2016-03-03 13:42:27 -08:00
vendor moved go files back to root 2016-09-27 17:54:48 -07:00
.dockerignore Add dockerignore 2015-11-23 21:12:39 +00:00
.gitignore Remove checked in 'dockercraft' binary 2016-12-08 18:07:58 +00:00
CONTRIBUTING.md Added CONTRIBUTING.md 2015-11-12 10:29:56 -08:00
Dockerfile Remove remains of vendored Cuberite 2016-12-08 18:05:08 +00:00
LICENSE add apache 2 licence file 2015-11-15 01:55:31 +01:00
MAINTAINERS this updates the MAINTAINERS file to the new toml format, 2015-12-04 10:06:44 -08:00
Makefile moved some files to different locations 2016-09-27 12:49:31 -07:00
README.md absolute image urls in README 2016-09-26 17:29:46 -07:00
circle.yml Refactor to single Go daemon 2016-08-16 23:44:19 +01:00
daemon.go moved go files back to root 2016-09-27 17:54:48 -07:00
docker-compose.yml Sample docker-compose.yml 2015-11-19 17:21:35 -08:00
main.go moved go files back to root 2016-09-27 17:54:48 -07:00
setup.go Add support for Docker RC's 2016-12-08 18:07:57 +00:00

README.md

Dockercraft

Dockercraft

A simple Minecraft Docker client, to visualize and manage Docker containers.

Dockercraft

YouTube video

WARNING: Please use Dockercraft on your local machine only. It currently doesn't support authentication. Every player should be considered a root user!

How to run Dockercraft

  1. Install Minecraft: minecraft.net

    The Minecraft client hasn't been modified, just get the official release.

  2. Pull or build Dockercraft image: (an offical image will be available soon)

    docker pull gaetan/dockercraft
    

    or

    git clone git@github.com:docker/dockercraft.git
    docker build -t gaetan/dockercraft dockercraft
    
  3. Run Dockercraft container:

    docker run -t -i -d -p 25565:25565 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --name dockercraft \
    gaetan/dockercraft
    

    Mounting /var/run/docker.sock inside the container is necessary to send requests to the Docker remote API.

    The default port for a Minecraft server is 25565, if you prefer a different one: -p <port>:25565

  4. Open Minecraft > Multiplayer > Add Server

    The server address is the IP of Docker host. No need to specify a port if you used the default one.

    If you're using Docker Machine: docker-machine ip <machine_name>

  5. Join Server!

    You should see at least one container in your world, which is the one hosting your Dockercraft server.

    You can start, stop and remove containers interacting with levers and buttons. Some Docker commands are also supported directly via Minecraft's chat window, which is displayed by pressing the T key (default) or / key.

A command always starts with a /.

If you open the prompt using the / key, it will be prefilled with a / character, but if you open it with the T key, it will not be prefilled and you will have to type a / yourself before typing your docker command.

example: /docker run redis.

Dockercraft

Upcoming features

This is just the beginning for Dockercraft! We should be able to support a lot more Docker features like:

  • List Docker Machines and use portals to see what's inside
  • Support more Docker commands
  • Display logs (for each container, pushing a simple button)
  • Represent links
  • Docker networking
  • Docker volumes
  • ...

If you're interested about Dockercraft's design, discussions happen in that issue. Also, we're using Magicavoxel to do these nice prototypes:

Dockercraft

You can find our Magicavoxel patterns in that folder.

To get fresh news, follow our Twitter account: @dockercraft.

How it works

The Minecraft client itself remains unmodified. All operations are done server side.

The Minecraft server we use is http://cuberite.org. A custom Minecraft compatible game server written in C++. github repo

This server accepts plugins, scripts written in Lua. So we did one for Docker. (world/Plugins/Docker)

Unfortunately, there's no nice API to communicate with these plugins. But there's a webadmin, and plugins can be responsible for "webtabs".

Plugin:AddWebTab("Docker",HandleRequest_Docker)

Basically it means the plugin can catch POST requests sent to http://127.0.0.1:8080/webadmin/Docker/Docker.

Goproxy

Events from the Docker remote API are transmitted to the Lua plugin by a small daemon (written in Go). (go/src/goproxy)

func MCServerRequest(data url.Values, client *http.Client) {
	req, _ := http.NewRequest("POST", "http://127.0.0.1:8080/webadmin/Docker/Docker", strings.NewReader(data.Encode()))
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.SetBasicAuth("admin", "admin")
	client.Do(req)
}

The goproxy binary can also be executed with parameters from the Lua plugin, to send requests to the daemon:

function PlayerJoined(Player)
	-- refresh containers
	r = os.execute("goproxy containers")
end

Contributing

Want to hack on Dockercraft? Docker's contributions guidelines apply.

Dockercraft