Running a Minecraft server inside a Docker container?

  • People have set up Minecraft servers on Raspberry Pi's in docker containers before, but I haven't found any clues on how to do it yet with LibreELEC.

    I found these two Docker projects:

    GitHub - frozenfoxx/rpi-minecraft-server: Minecraft Server for the Raspberry Pi in Docker (last updated 4 years ago)

    and

    GitHub - kroonwijk/rpi-minecraft: An easy way to get a Minecraft server up and running using docker on a Raspberry Pi (ARM) (last updated 5 years ago)

    But I ran into problems right away following the instructions because of: "-sh: git: not found"

    I don't really know how to precede from here. Any insight into this would be greatly appreciated! ^^

  • Please note the LibreELEC is a custom OS build which is lightened and tuned for multimedia. So many commands from a 'full' RPi OS won't work as they are missing.

    I have no experience with Docker but perhaps you could build the rpi-minecraft container under standard - 'full' - RPi OS and then run it from LibreELEC's Docker.

  • Instead of git clone you can use the tar file download, e.g.:

    Code
    wget -O - https://github.com/kroonwijk/rpi-minecraft/tarball/master | tar xz
  • You don't need git for docker. Just use the docker commands to pull the image from docker hub and create a container

    I didn't even know Docker Hub was thing! There's tons of containers there for Minecraft and everything else.

    ... and if you try this? (seems compatible with any x86_64, arm, and arm64 device)

    itzg/minecraft-server: Docker Hub

    I got this to actually run! The only problem now is that keeps telling me to accept the EULA. The command to accept the EULA doesn't seem to work with LIBREELEC's implementation of Docker.

    I don't know where the container is saving data if it is at all. I thought it would be in addon_data.

    Instead of git clone you can use the tar file download, e.g.:

    Code
    wget -O - https://github.com/kroonwijk/rpi-minecraft/tarball/master | tar xz

    That seemed to work, thank you!

    Now I'm running into this problem trying to run various containers:

    docker: no matching manifest for linux/arm/v7 in the manifest list entries.

    Is there something I'm missing here?

    I'd like to run this one if possible: GitHub - Phyremaster/papermc-docker: Docker image for a PaperMC Minecraft server.

    As it's the most developed, but I don't think it runs on ARM32v7 architecture.

    I was able to pull this one successfully: GitHub - Dko1905/papermc-docker: A simple papermc image for docker.

    It's definitely ARM32v7 compatible.

    Ran into problems running it though.

    If I do: docker run rhuss/papermc

    I get:

    But I'm supposed to run this command:

    Code
    docker run --rm \
        --name papermc \
        -v /home/joe/paperserver/:/data:rw \
        -p 25565:25565 \
        -e JVM_MEMORY=1G

    And it doesn't seem possible with my SSH client, so I removed the indents and the \'s and I get this error:

    "docker run" requires at least 1 argument.

    So I'm obviously not doing something right...

    I'm way over my head with this, so I should probably just shelve the idea.

    Edited 3 times, last by Morawake (July 9, 2021 at 9:24 AM).

  • I don't know where the container is saving data if it is at all. I thought it would be in addon_data.

    This is easy to fix. Install docker portainer and click on "Exec console" to enter the minecraft directory tree. If you need to access a directory from LibreELEC then delete the minecraft container and run it again adding the parameter "-v <libreelec-directory>:<minecraft-directory>".

    Example:

  • And it doesn't seem possible with my SSH client, so I removed the indents and the \'s and I get this error:

    "docker run" requires at least 1 argument.

    Without "\" you have to put it into one line. Furthermore /home/joe/paperserver does not exist in LibreELEC. Try

    Code
    docker run --rm --name papermc -v /storage/minecraft/:/data:rw -p 25565:25565 -e JVM_MEMORY=1G

    For docker run see docker run | Docker Documentation

  • This is easy to fix. Install docker portainer and click on "Exec console" to enter the minecraft directory tree. If you need to access a directory from LibreELEC then delete the minecraft container and run it again adding the parameter "-v <libreelec-directory>:<minecraft-directory>".

    I was able to connect to the server! I just had to hit recreate in portainer and EULA got accepted.

    I ran this command to create the server and create a directory I can access:

    docker run -d -it -v /storage/Minecraft_Server/:/data:rw -p 25565:25565 -e EULA=TRUE itzg/minecraft-server

    I'm going to see if I can run a PaperMC server from this container next.

    Edit: I was able to do just that with this command:

    docker run -d -it -v /storage/Minecraft_Server/:/data:rw -p 25565:25565 -e TYPE=PAPER -e PAPER_DOWNLOAD_URL=https://papermc.io/api/v2/projects/paper/versions/1.17.1/builds/96/downloads/paper-1.17.1-96.jar -e EULA=TRUE itzg/minecraft-server

    I can't seem to add more than 2GB's of memory with -e MEMORY=2G

    I'm using an 8GB Raspberry Pi.

    Edit:

    I tried this command: docker update -m 5g Minecraft_Server

    But I get this: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.

    The autopause function is pretty neat for hibernating the server when no one is on.

    The CPU reaches 400% quite easily and this is with a max overclock of 2222.

    Successfully migrated the server from Windows, just had to change file permissions to be writable.

    Game runs smooth, generating new terrain can be a little hit or or miss.

    Running a Plex server on the Pi as well, and 4k movie play back while the Minecraft server is running works fine, even if someone is connected. The server load when no one is connected remains at about 15/400 of the CPU.

    Code
    docker run --rm --name papermc -v /storage/minecraft/:/data:rw -p 25565:25565 -e JVM_MEMORY=1G

    When I ran the command I got:

    Code
    "docker run" requires at least 1 argument.
    See 'docker run --help'.
    
    
    Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
    
    
    Run a command in a new container

    So it didn't work, but seeing how you formatted -v was instrumental in figuring out how to format it correctly for the other command.

    Edited 18 times, last by Morawake (July 10, 2021 at 12:32 AM).