Docker Sponge
Docker sponge is a Minecraft server environment for Sponge / Forge servers.
Supports Sponge Vanilla and Sponge Forge
Not meant for production environments
Quick Setup
Install Docker Toolbox
Install Virtualbox
Clone project:
$ git clone git@github.com:mmonkey/docker-sponge.git $ cd docker-sponge/
Run the setup
Create both Sponge Forge and Sponge Vanilla:
$ ./setup.sh
Create only Sponge Forge:
$ sponge-forge/setup.sh
Create only Sponge Vanilla:
$ sponge-vanilla/setup.sh
Browse and update your Mincraft server files in the following locations:
docker-sponge/sponge-forge/data
docker-sponge/sponge-vanilla/data
Customizing Quick Setup
Edit the
docker-compose.yml
in the root of the project.You can update the following settings:
Container Name
Port(s)
Sponge and Forge Versions
Memory
You may add additional ports by adding to the
ports:
andexpose:
sections.If you already have a running container you can destroy it:
$ docker stop forge $ docker rm forge
and/or
$ docker stop vanilla $ docker rm vanilla
Re-build your container:
Both containers (from
docker-sponge/
directory):$ docker-compose up -d
Only Sponge Forge:
$ cd docker-forge/ $ docker-compose up -d
Only Sponge Vanilla:
$ cd docker-vanilla/ $ docker-compose up -d
Manual Setup
Install Docker Toolbox
Install Virtualbox
Create a docker-machine and setup your environment:
$ docker-machine create --driver virtualbox sponge $ eval "$(docker-machine env sponge)"
Create container(s):
Sponge Forge
``` $ docker run -itd -p 25566:25566 \ -v /path/on/host:/forge \ -e MINECRAFT_PORT=25566 \ -e MINECRAFT_EULA=true \ -e MINECRAFT_MAXHEAP=1024M \ -e FORGE_VERSION=1.8.9-11.15.1.1890-1.8.9 \ -e SPONGE_VERSION=1.8.9-1890-4.2.0-BETA-1446 \ --name forge mmonkey/sponge-forge ```
Sponge Vanilla
``` $ docker run -itd -p 25567:25567 \ -v /path/on/host:/vanilla \ -e MINECRAFT_PORT=25567 \ -e MINECRAFT_MAXHEAP=1024M \ -e MINECRAFT_EULA=true \ -e SPONGE_VERSION=1.8.9-4.2.0-BETA-337 \ --name vanilla mmonkey/sponge-vanilla ```
Minecraft server files will be placed in the path you specified on this line
-v /path/on/host:/forge
On Windows, the host path should start from
/c/Users/<path>
On Mac, the host path should start from
/Users/<path>
You may add additional ports by adding
-p XXXX:XXXX --expose XXXX
(changeXXXX
to the desired port number)
Connecting to the server
Local Machine
Obtain the server's ip address:
$ docker-machine ip sponge
Ports (default)
Forge: xxx.xxx.xx.xx:25566
Vanilla: xxx.xxx.xx.xx:25567
Network
Open Oracle VM VirtualBox Manager
Select the VM used by Docker (sponge)
Click Settings -> Network
Make sure Adapter 1 is set to "NAT"
Click Advanced -> Port Forwarding
Add the rules that apply:
Name: Forge, Protocol: TCP, Host Port: 25566, Guest Port: 25566 (Leave Host IP and Guest IP empty)
Name: Vanilla, Protocol: TCP, Host Port: 25567, Guest Port: 25567 (Leave Host IP and Guest IP empty)
Restart docker-machine:
$ docker-machine stop sponge $ docker-machine start sponge
Attaching to the running containers:
Windows:
$ winpty docker attach forge
$ winpty docker attach vanilla
Mac/Linux:
$ docker attach forge
$ docker attach vanilla
Detaching from the running containers:
Keystroke: [CTRL]
+ [p]
then [CTRL]
+ [q]
NOTE: If you [CTRL]
+ [c]
while attached to the running container, the container will be stopped.
Starting and stopping the server
$ docker stop forge
$ docker start forge
or
$ docker stop vanilla
$ docker start vanilla
Starting, stopping and restarting the virtual machine
You will need to start the docker machine if the Host computer restarts or powers off
You may want to stop the docker machine to preserve the Host computers resources
Starting docker machine
$ docker-machine start sponge
Stopping docker machine
$ docker-machine stop sponge
Restarting docker machine
$ docker-machine restart sponge
Troubleshooting
When trying to run docker commands in a new bash window:
An error occurred trying to connect:
$ eval "$(docker-machine env sponge)"