Created
March 19, 2019 22:58
-
-
Save amolloy/095a4799bfc778ed03f4fc160a0c4cb9 to your computer and use it in GitHub Desktop.
Import an existing minecraft server world into a new docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d "$1" ]; then | |
echo Unknown directory $1, aborting. | |
exit 1 | |
fi | |
re='^[0-9]+$' | |
if ! [[ $2 =~ $re ]]; then | |
echo Second argument must be the port number. Abording. | |
exit 2 | |
fi | |
WORLD=`basename $1` | |
echo Importing $WORLD from $1. | |
docker create -e EULA=TRUE -e TYPE=PAPER -e ONLINE_MODE=FALSE -p $2:25565 --name MC-$WORLD itzg/minecraft-server --noconsole | |
docker cp $1/. MC-$WORLD:/data/ | |
docker start MC-$WORLD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment