2014-12-06 16:26:03 +00:00
This docker image provides a Minecraft Server that will automatically download the latest stable
version at startup. You can also run/upgrade to any specific version or the
latest snapshot. See the *Versions* section below for more information.
2014-11-09 16:49:31 +00:00
2014-06-02 02:48:31 +00:00
To simply use the latest stable version, run
2014-11-09 16:49:31 +00:00
2014-09-07 23:18:20 +00:00
docker run -d -p 25565:25565 itzg/minecraft-server
2014-11-09 16:49:31 +00:00
2014-09-20 20:54:23 +00:00
where the default server port, 25565, will be exposed on your host machine. If you want to serve up multiple
Minecraft servers or just use an alternate port, change the host-side port mapping such as
docker run -p 25566:25565 ...
2014-11-09 16:49:31 +00:00
will serve your Minecraft server on your host's port 25566 since the `-p` syntax is
2014-09-28 21:27:03 +00:00
`host-port` :`container-port`.
2014-09-20 20:54:23 +00:00
Speaking of multiple servers, it's handy to give your containers explicit names using `--name` , such as
2014-09-28 21:27:03 +00:00
docker run -d -p 25565:25565 --name minecraft-default itzg/minecraft-server
2014-09-20 20:54:23 +00:00
With that you can easily view the logs, stop, or re-start the container:
2014-11-09 16:49:31 +00:00
2014-09-28 21:27:03 +00:00
docker logs -f minecraft-default
2014-09-20 20:54:23 +00:00
( Ctrl-C to exit logs action )
2014-11-09 16:49:31 +00:00
2014-09-28 21:27:03 +00:00
docker stop minecraft-default
2014-11-09 16:49:31 +00:00
2014-09-28 21:27:03 +00:00
docker start minecraft-default
2014-11-09 16:49:31 +00:00
## EULA Support
2014-09-07 23:18:20 +00:00
Mojang now requires accepting the [Minecraft EULA ](https://account.mojang.com/documents/minecraft_eula ). To accept add
2014-11-09 16:49:31 +00:00
2014-09-20 14:10:48 +00:00
-e EULA=TRUE
2014-11-09 16:49:31 +00:00
such as
docker run -e EULA=TRUE -d -p 25565:25565 itzg/minecraft-server
## Attaching data directory to host filesystem
2014-12-06 16:26:03 +00:00
In order to readily access the Minecraft data, use the `-v` argument
2014-11-09 16:49:31 +00:00
to map a directory on your host machine to the container's `/data` directory, such as:
docker run -d -v /path/on/host:/data ...
2014-09-20 14:10:48 +00:00
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` and start the server again with `docker start CONTAINERID` to pick up the new configuration.
2014-11-09 16:49:31 +00:00
## Versions
2014-09-07 23:18:20 +00:00
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
2014-09-25 21:51:54 +00:00
2014-11-09 16:49:31 +00:00
* LATEST
* SNAPSHOT
* (or a specific version, such as "1.7.9")
For example, to use the latest snapshot:
docker run -d -e VERSION=SNAPSHOT ...
or a specific version:
docker run -d -e VERSION=1.7.9 ...
## Server configuration
2014-09-28 21:27:03 +00:00
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
where the default is "world":
docker run -d -e LEVEL=bonus ...
2014-09-28 21:48:44 +00:00
**NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each
2014-11-09 16:49:31 +00:00
`LEVEL` in use or don't use `-v` and the container's filesystem will keep things encapsulated.
2014-06-02 02:48:31 +00:00
The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as
2014-11-09 16:49:31 +00:00
docker run -d -e 'MOTD=My Server' ...
2014-09-28 21:27:03 +00:00
If you leave it off, the last used or default message will be used. _The example shows how to specify a server
message of the day that contains spaces by putting quotes around the whole thing._
2014-11-09 16:49:31 +00:00
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
docker run -d -e OPS=user1,user2 ...
A server icon can be configured using the `ICON` variable. The image will be automatically
downloaded, scaled, and converted from any other image format:
docker run -d -e ICON=http://..../some/image.png
2014-12-06 16:26:03 +00:00
2014-09-20 14:10:48 +00:00
The Java memory limit can be adjusted using the `JVM_OPTS` environment variable, where the default is
2014-09-08 02:32:55 +00:00
the setting shown in the example (max and min at 1024 MB):
2014-11-09 16:49:31 +00:00
2014-09-08 02:32:55 +00:00
docker run -e 'JVM_OPTS=-Xmx1024M -Xms1024M' ...