Last active
January 27, 2021 09:13
-
-
Save RolandWarburton/eaf389e4d2ab393bd1a065819d22dd6c to your computer and use it in GitHub Desktop.
Direwolf20 FTB docker
This file contains hidden or 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
FROM openjdk:8-jre | |
# Install stuff and prep the container | |
RUN apt-get update && apt install apt-utils --yes | |
RUN apt-get upgrade --yes --allow-remove-essential | |
RUN apt-get clean | |
RUN rm -rf /var/lib/apt/lists/* | |
# The server will be installed here | |
RUN mkdir -p /usrc/src/server/world | |
WORKDIR /usr/src/server | |
# Add user | |
RUN useradd -m -U minecraft | |
# Get the server installer and run it | |
RUN wget https://api.modpacks.ch/public/modpack/79/220/server/linux -O serverinstall_79_220 | |
RUN chmod 755 serverinstall_* | |
RUN echo "y" | ./serverinstall_* | |
# Fix the EULA | |
RUN echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." > eula.txt | |
RUN echo "$(date)" >> eula.text | |
RUN echo "eula=TRUE" >> eula.txt | |
RUN chown -R minecraft:minecraft /usr/src/server | |
# Remove the glitched eula.txt | |
RUN sed -i '2,6d' /usr/src/server/start.sh | |
# Change user to Minecraft | |
USER minecraft | |
# Expose minecraft port | |
EXPOSE 25565 | |
# op myself | |
RUN echo [{"uuid": "a5093dbf-3d33-496f-8949-c841e3ddde0b", "name": "Box0fnoobs", "level": 4 }] > /usr/src/server/ops.json | |
# Start the server, avoid messing with the world mount because it breaks things | |
RUN chmod 777 -R $(ls -I world) | |
CMD ["/bin/bash", "/usr/src/server/start.sh"] |
Here is a good starting place for your docker-compose.yaml
version: "3.3"
services:
server:
container_name: server
image: server
volumes:
- "/home/roland/serverTest/world:/usr/src/server/world"
ports:
- "25565:25565"
Another common problem is an error where world/session.lock
cannot be read. To solve this i copied the world file from /usr/src/server/world
to my mount location and then restarted again. To do this you can use docker cp server:/usr/src/server/world world
. syntax is docker cp container_name:/source/localtion dest/location
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this on the host if required to resolve
java.lang.RuntimeException: Unable to create the autoreloaded config
which is caused byIOException: User limit of inotify watches reached
.RUN echo 16384 | tee /proc/sys/fs/inotify/max_user_watches