Welcome to Necesse – Dedicated Server in Docker Config Guide.
A very basic essential dedicated server that boots up automatically and updates itself with or without Docker mods
This guide contains scripts such as:
- Dockerfile
- Building
- Testing
- Run a Server with No/Self Managed Mods
- Run a Server with Mods
Dockerfile
######## Auto Updating Necesse Server ######## FROM openjdk:latest ENV USER necesse ENV HOME /home/necesse WORKDIR $HOME COPY --from=steamcmd/steamcmd:latest /usr/lib/games/steam /usr/lib/games/steam COPY --from=steamcmd/steamcmd:latest /usr/bin/steamcmd /usr/bin/steamcmd COPY --from=steamcmd/steamcmd:latest /etc/ssl/certs /etc/ssl/certs COPY --from=steamcmd/steamcmd:latest /lib /lib RUN mkdir necesse RUN printf '#!/bin/bash \n\ steamcmd +login anonymous +force_install_dir ${HOME}/necesse +app_update 1169370 validate +quit \n\ i=1 \n\ variable="MOD_$i" \n\ value=${!variable} \n\ if test ! -z "$value"; then \n\ mkdir -p .config/Necesse/mods \n\ rm .config/Necesse/mods/* \n\ fi \n\ while test ! -z "$value"; do \n\ steamcmd +login "$STEAM_USER" "$STEAM_PASSWORD" +force_install_dir $HOME +workshop_download_item 1169040 $value +quit \n\ i=$((i+1)) \n\ variable="MOD_$i" \n\ value=${!variable} \n\ mv steamapps/workshop/content/**/**/*.jar .config/Necesse/mods \n\ done \n\ java -jar ${HOME}/necesse/Server.jar -nogui [email protected] \n\ ' >> entrypoint RUN chmod +x entrypoint # If you wish a cold start container, comment the next Line in RUN steamcmd +login anonymous +force_install_dir ${HOME}/necesse +app_update 1169370 validate +quit ENTRYPOINT ["./entrypoint"] EXPOSE 14159
Building
docker build . -t necesse-server
Testing
Just test it with interactive mode:
docker run -it necesse-server
But it makes more sense to run it as a demon, you also can use all the default start parameters:
docker run -d necesse-server -world mynewworld
Run a Server with No/Self Managed Mods
docker run -d --mount type=bind,source=</a/directory/on/your/harddrive>,target=/home/necesse/.config/Necesse/ -p 14159:14159 necesse-server -world <worldname>
in a docker-compose.yml it would look something like this:
version: '3.7' services: necesse-server: restart: unless-stopped build: . ports: - "14159:14159" volumes: - type: bind source: /srv/docker/necesse-config/ target: /home/necesse/.config/Necesse/ command: ["-world", "myworldname"]
Run a Server with Mods
You must give steam credentials for an account that owns the game and is not steam guard protected in order to host an automated mod server because you can only download mods from the Steam workshop if you also own the game.
For this example, the pa*sword is plaintext even though you should provide it with a docker secret.
docker run -d --env STEAM_USER=<ASteamAccountWhichOwnsNecesse> --env STEAM_PASSWORD=<SteamPa*sword> --env MOD_1=<modId> --env MOD_2=<modId> --mount type=bind,source=</a/directory/on/your/harddrive>,target=/home/necesse/.config/Necesse/ necesse-server -world <worldname>
in a docker-compose.yml:
version: '3.7' services: necesse-server: restart: unless-stopped build: . ports: - "14159:14159" volumes: - type: bind source: /srv/docker/necesse-config/ target: /home/necesse/.config/Necesse/ command: ["-world", "myworldname"] environment: STEAM_USER: ASteamAccountWhichOwnsNecesse STEAM_PASSWORD: SteamPa*sword MOD_1: 2833909781 # Better Enchantment Mod
This is all about Necesse – Dedicated Server in Docker Config; I hope you enjoy reading the Guide! If you feel like we should add more information or we forget/mistake, please let us know via commenting below, and thanks! See you soon!
- All Necesse Posts List
Leave a Reply