├── .dockerignore ├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug.yml │ ├── config.yml │ └── enhancement.yml ├── dependabot.yml ├── release.yml └── workflows │ ├── build-multiarch.yml │ ├── discord.yml │ ├── issue-label.yml │ ├── stale-check.yml │ └── verify-pr.yml ├── .gitignore ├── .readthedocs.yaml ├── Dockerfile ├── LICENSE ├── README.md ├── bin ├── mc-health ├── mc-send-to-console ├── mcstatus └── rcon-cmds-daemon.sh ├── build ├── alpine │ ├── install-packages.sh │ └── setup-user.sh ├── ol │ ├── install-gosu.sh │ ├── install-packages.sh │ └── setup-user.sh ├── run.sh └── ubuntu │ ├── install-packages.sh │ └── setup-user.sh ├── docker-compose-mkdocs.yml ├── docker-compose.yml ├── docs ├── Dockerfile ├── commands.md ├── configuration │ ├── auto-rcon-commands.md │ ├── interpolating.md │ ├── jvm-options.md │ ├── misc-options.md │ └── server-properties.md ├── css │ └── extra.css ├── data-directory.md ├── img │ ├── .gitignore │ ├── Going from docker run to compose.drawio.png │ ├── Minecraft server containment.xml │ ├── cf-file-id.png │ ├── cf-project-id.png │ ├── cf-slug.png │ ├── docs-banner.png │ ├── docs-banner.txt │ ├── example-autocf-downloads.drawio.png │ ├── ftba-version-id-popup.png │ ├── level-vs-world.drawio.png │ ├── modrinth-project-id.drawio.png │ ├── modrinth-project-slug.drawio.png │ ├── modrinth-version-id.drawio.png │ ├── motd-example.png │ ├── start-script-flow.drawio.png │ └── world-copy-compose-project.drawio.png ├── index.md ├── misc │ ├── autopause-autostop │ │ ├── autopause.md │ │ └── autostop.md │ ├── contributing │ │ ├── building.md │ │ ├── development.md │ │ └── docs.md │ ├── deployment │ │ └── index.md │ ├── examples.md │ ├── healthcheck.md │ ├── log4j.md │ ├── raspberrypi.md │ ├── related-projects.md │ ├── troubleshooting.md │ └── world-data.md ├── mods-and-plugins │ ├── curseforge-files.md │ ├── index.md │ ├── modrinth.md │ ├── packwiz.md │ └── spiget.md ├── requirements.txt ├── types-and-platforms │ ├── index.md │ ├── mod-platforms │ │ ├── auto-curseforge.md │ │ ├── curseforge.md │ │ ├── ftb.md │ │ └── modrinth-modpacks.md │ └── server-types │ │ ├── bukkit-spigot.md │ │ ├── fabric.md │ │ ├── forge.md │ │ ├── hybrids.md │ │ ├── others.md │ │ ├── paper.md │ │ └── quilt.md ├── variables.md └── versions │ ├── java.md │ └── minecraft.md ├── examples ├── .gitignore ├── README.md ├── aof7 │ └── docker-compose.yml ├── atm10 │ └── docker-compose.yml ├── atm8 │ ├── docker-compose.yml │ └── filebrowser.json ├── atm9 │ └── docker-compose.yml ├── auto-cf │ ├── modpack-manifest │ │ ├── docker-compose.yml │ │ └── manifests │ │ │ └── manifest.json │ └── using-excludes │ │ └── docker-compose.yml ├── autopause │ └── compose.yml ├── bettermc │ └── docker-compose.yml ├── bmc4 │ └── compose.yml ├── canyon │ └── compose.yml ├── cleanroom │ └── compose.yml ├── craftoria │ └── docker-compose.yml ├── curseforge-files │ └── docker-compose.yml ├── docker-compose-autostop.yml ├── docker-compose-big.yml ├── docker-compose-curseforge-atm7.yaml ├── docker-compose-curseforge.yml ├── docker-compose-forge-bettermcplus ├── docker-compose-forge.yml ├── docker-compose-generic-pack-tnp5.yml ├── docker-compose-generic-pack.yml ├── docker-compose-magma.yml ├── docker-compose-modrinth.yml ├── docker-compose-mods-mount.yml ├── docker-compose-mohist.yml ├── docker-compose-ngrok.yml ├── docker-compose-proxied.yml ├── docker-compose-rconcmd.yml ├── docker-compose-rlcraft.yml ├── docker-compose-simple.yml ├── docker-compose-spongeforge.yml ├── docker-compose-tailscale.yml ├── docker-compose-world-download.yml ├── docker-compose.yml ├── downloads │ └── .gitignore ├── fabric-cardboard │ └── compose.yml ├── fabric │ └── compose.yml ├── ftb-evolution │ └── compose.yaml ├── ftba │ └── compose.yml ├── geyser │ └── docker-compose.yml ├── gtnh │ └── docker-compose.yaml ├── jline │ └── docker-compose.yml ├── k8s │ ├── using-statefulset.yml │ └── vanilla-deployment.yml ├── ketting │ └── docker-compose.yml ├── lazymc │ └── docker_compose.yml ├── lazytainer │ └── docker_compose.yml ├── modpacks │ ├── .gitignore │ └── README.md ├── modrinth-modpack │ └── docker-compose.yml ├── modrinth-paper │ └── docker-compose.yml ├── modrinth │ └── local-modpack │ │ └── docker-compose.yml ├── mods-file │ ├── docker-compose.yml │ └── mods.txt ├── multi-project │ ├── README.md │ ├── dbs │ │ ├── .env │ │ └── docker-compose.yml │ └── servers │ │ ├── docker-compose.yml │ │ ├── mc-plugins │ │ └── LuckPerms │ │ │ └── config.yml │ │ ├── velocity-config │ │ └── velocity.toml │ │ └── waterfall-config │ │ ├── config.yml │ │ └── waterfall.yml ├── multiline-motd │ └── docker-compose.yml ├── neoforge │ └── docker-compose.yml ├── one-block-modded │ ├── .gitignore │ └── docker-compose.yml ├── optimized-paper-config │ ├── README.md │ └── docker-compose.yml ├── paper │ ├── compose.yml │ ├── paper-build-plugins │ │ ├── Dockerfile │ │ ├── docker-compose.yml │ │ └── plugins │ │ │ ├── .gitignore │ │ │ └── README.md │ └── paper-proxy-protocol │ │ ├── config │ │ └── paper-global.yml │ │ └── docker-compose.yml ├── pixelmon │ └── docker-compose.yml ├── prominence2 │ └── docker-compose.yml ├── quilt │ └── docker-compose.yml ├── rad2 │ └── compose.yaml ├── rlcraft │ └── docker-compose.yml ├── simple-voice-chat │ ├── fabric-compose.yaml │ ├── neoforge-compose.yaml │ └── paper-compose.yaml ├── skript │ └── docker-compose.yml ├── skyfactory5 │ └── compose.yml ├── spiget │ └── docker-compose.yml ├── spigot │ └── docker-compose.yml ├── valhelsia2 │ └── docker-compose.yml ├── valhesia5 │ └── docker-compose.yml ├── vanilla-tweaks │ ├── docker-compose.yml │ ├── vanillatweaks-craftingtweaks.json │ ├── vanillatweaks-datapacks.json │ └── vanillatweaks-resourcepacks.json └── vault-hunters-1-18-2 │ └── docker-compose.yml ├── files ├── auto │ ├── autopause-daemon.sh │ ├── autopause-fcns.sh │ ├── autostop-daemon.sh │ ├── knockd-config.cfg │ ├── pause.sh │ ├── resume.sh │ └── stop.sh ├── cf-exclude-include.json ├── log4j2.xml ├── modrinth-exclude-include.json ├── property-definitions.json └── server.properties ├── kustomize ├── README.md └── base │ ├── kustomization.yml │ ├── service.yml │ └── statefulset.yml ├── mkdocs.yml ├── notes ├── .gitignore ├── Going from docker run to compose.drawio.png ├── Hairpin routing.drawio.png ├── Minecraft server containment.xml ├── Understanding class file version errors.drawio.png ├── container-network-namespaces.drawio.png ├── rbac-processing.mmd └── start-script-flow.drawio.png ├── scripts ├── start ├── start-autopause ├── start-autostop ├── start-configuration ├── start-deployArcLight ├── start-deployAutoCF ├── start-deployBukkitSpigot ├── start-deployCF ├── start-deployCanyon ├── start-deployCatserver ├── start-deployCrucible ├── start-deployCustom ├── start-deployFTBA ├── start-deployFabric ├── start-deployFolia ├── start-deployForge ├── start-deployKetting ├── start-deployLeaf ├── start-deployLimbo ├── start-deployMagma ├── start-deployMagmaMaintained ├── start-deployModrinth ├── start-deployMohist ├── start-deployNanoLimbo ├── start-deployNeoForge ├── start-deployPaper ├── start-deployPoseidon ├── start-deployPufferfish ├── start-deployPurpur ├── start-deployQuilt ├── start-deploySpongeVanilla ├── start-deployVanilla ├── start-finalExec ├── start-rconcmds ├── start-setupDatapack ├── start-setupEnvVariables ├── start-setupModpack ├── start-setupMounts ├── start-setupRbac ├── start-setupServerProperties ├── start-setupWorld ├── start-spiget └── start-utils └── tests ├── .gitignore ├── fulltests ├── multi-part-motd │ └── docker-compose.yml ├── test.sh └── vanilla-latest │ └── docker-compose.yml ├── setuponlytests ├── auto_curseforge │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── auto_curseforge_file │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── cf_files │ ├── docker-compose.yml │ ├── fake.jar │ ├── listing.txt │ ├── require.sh │ └── verify.sh ├── conflicting_world_for_spigot_server │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.zip ├── conflicting_world_for_vanilla_server │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.zip ├── curseforge │ ├── docker-compose.yml │ ├── modpacks │ │ └── pack.zip │ ├── require.sh │ └── verify.sh ├── defaults │ ├── docker-compose.yml │ └── verify.sh ├── generic-packs-prefix │ ├── docker-compose.yml │ ├── packs │ │ └── testing.zip │ └── verify.sh ├── generic-packs │ ├── docker-compose.yml │ ├── fake.jar │ ├── packs │ │ └── testing.zip │ ├── verify.sh │ └── web │ │ └── configs.zip ├── icon-file-exact │ ├── docker-compose.yml │ ├── extra │ │ └── 4737386_minecraft_squircle_icon_64x64.png │ ├── fake.jar │ ├── require.sh │ └── verify.sh ├── icon-file-scale │ ├── docker-compose.yml │ ├── extra │ │ └── 4737386_minecraft_squircle_icon.png │ ├── fake.jar │ └── verify.sh ├── icon-gif-multiframe │ ├── docker-compose.yml │ ├── fake.jar │ ├── require.sh │ ├── verify.sh │ └── web │ │ └── motion-tween-example.gif ├── icon-png-atscale │ ├── docker-compose.yml │ ├── fake.jar │ ├── require.sh │ ├── verify.sh │ └── web │ │ └── 4737386_minecraft_squircle_icon.png ├── icon-png-scale │ ├── docker-compose.yml │ ├── fake.jar │ ├── verify.sh │ └── web │ │ └── 4737386_minecraft_squircle_icon.png ├── modrinth │ ├── docker-compose.yml │ └── verify.sh ├── mounts-custom │ ├── custom │ │ ├── config │ │ │ └── test.json │ │ ├── mods │ │ │ └── mod.jar │ │ └── plugins │ │ │ └── plugin.jar │ ├── docker-compose.yml │ ├── fake.jar │ └── verify.sh ├── ops_from_scratch │ ├── docker-compose.yml │ └── verify.sh ├── packwiz │ ├── docker-compose.yml │ ├── fake.jar │ ├── require.sh │ ├── verify.sh │ └── web │ │ ├── index.toml │ │ ├── mods │ │ └── architectury-api.pw.toml │ │ └── pack.toml ├── pufferfish │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── quilt │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── spiget │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── spigot_world_for_spigot_server │ ├── docker-compose.yml │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.zip ├── spigot_world_for_vanilla_server │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.zip ├── spongevanilla_version_compare │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── test.sh ├── vanilla_world_for_spigot_server │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.zip ├── vanilla_world_for_vanilla_server │ ├── docker-compose.yml │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.zip ├── vanillatweaks_file │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ ├── vt-craftingtweaks.json │ ├── vt-datapacks.json │ └── vt-resourcepacks.json ├── vanillatweaks_sharecode │ ├── docker-compose.yml │ ├── require.sh │ └── verify.sh ├── whitelist_from_scratch │ ├── docker-compose.yml │ └── verify.sh ├── world_from_tar │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.tar ├── world_from_tarbz2 │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.tar.bz2 ├── world_from_targz │ ├── docker-compose.yml │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.tar.gz ├── world_from_tarzst │ ├── docker-compose.yml │ ├── require.sh │ ├── verify.sh │ └── worlds │ │ └── world-for-testing.tar.zst └── world_from_zip │ ├── docker-compose.yml │ ├── verify.sh │ └── worlds │ └── world-for-testing.zip └── test.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | data 2 | testdata 3 | examples 4 | k8s-examples 5 | .idea 6 | .git 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [start-*] 2 | indent_size = 2 3 | indent_style = space 4 | end_of_line = lf 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=lf 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: itzg 2 | custom: 3 | - https://www.buymeacoffee.com/itzg 4 | - https://paypal.me/itzg 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | labels: 4 | - bug 5 | - status/needs triage 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Thanks for taking the time to report a bug. 11 | 12 | Please double check some things first: 13 | 1. Do you just have a question about something? If so, asking in the [Q&A Discussions](https://github.com/itzg/docker-minecraft-server/discussions/categories/q-a) or asking on [the Discord server](https://discord.gg/DXfKpjB) would be best. 14 | 2. Did you **re-pull the newest image** and confirmed the issue after that? Run `docker pull ` or if using a compose file, it's as easy as running `docker compose pull`. If using Kubernetes, add `imagePullPolicy: Always` to the container. 15 | 4. Is this bug happening after the `[init]` prefixed logs and after the log that says "Starting the Minecraft server"? If so, please report the bug with Mojang or the respective server provider. 16 | 5. Are you seeing a performance problem? If so, that is typically outside the scope of this image. Ask a question as above or contact the respective server provider. 17 | - type: textarea 18 | id: problem 19 | attributes: 20 | label: Describe the problem 21 | validations: 22 | required: true 23 | - type: textarea 24 | id: container 25 | attributes: 26 | label: Container definition 27 | description: Please provide the compose file or run command used to create the container 28 | value: | 29 | ``` 30 | Paste run command or compose file here 31 | ``` 32 | - type: textarea 33 | id: logs 34 | attributes: 35 | label: Container logs 36 | description: | 37 | Please provide container logs from the start of the container, which will be the ones prefixed with `[init]`. It is even better if you can set the variable `DEBUG` to "true" and provide those debug container logs. 38 | value: | 39 | ``` 40 | Paste logs here 41 | ``` 42 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Ask a question in discussions 3 | url: https://github.com/itzg/docker-minecraft-server/discussions 4 | about: Please ask questions here 5 | - name: Ask a question on Discord 6 | url: https://discord.gg/DXfKpjB 7 | about: Please ask questions here -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.yml: -------------------------------------------------------------------------------- 1 | name: Enhancement Request 2 | description: Request an enhancement 3 | labels: 4 | - enhancement 5 | - status/needs triage 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Thanks for taking the time to request an enhancement. 11 | 12 | Even if you plan on submitting a pull request with a contributed enhancement it is best to describe the enhancement here first. Somebody might already be working on a similar thing and could use your help. 13 | - type: dropdown 14 | id: type 15 | attributes: 16 | label: Enhancement Type 17 | options: 18 | - Improve an existing feature 19 | - A completely new feature 20 | - New server type 21 | - Not sure 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: description 26 | attributes: 27 | label: Describe the enhancement 28 | validations: 29 | required: true -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | groups: 8 | updates: 9 | patterns: 10 | - "*" 11 | update-types: 12 | - patch 13 | - minor 14 | - package-ecosystem: pip 15 | directory: "/docs" 16 | schedule: 17 | interval: weekly 18 | groups: 19 | patches: 20 | patterns: 21 | - "*" 22 | update-types: 23 | - patch 24 | - minor 25 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | exclude: 3 | authors: 4 | - dependabot 5 | categories: 6 | - title: Enhancements 7 | labels: 8 | - enhancement 9 | - title: Bug Fixes 10 | labels: 11 | - bug 12 | - title: Documentation 13 | labels: 14 | - documentation 15 | - title: Other Changes 16 | labels: 17 | - "*" 18 | -------------------------------------------------------------------------------- /.github/workflows/discord.yml: -------------------------------------------------------------------------------- 1 | name: Discord notifications 2 | 3 | on: 4 | release: 5 | types: 6 | - published 7 | workflow_run: 8 | workflows: ["Build and Publish"] 9 | types: 10 | - completed 11 | 12 | env: 13 | DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} 14 | 15 | jobs: 16 | discord: 17 | runs-on: ubuntu-latest 18 | timeout-minutes: 5 19 | steps: 20 | - name: on-publish 21 | if: github.event_name == 'release' && github.event.action == 'published' 22 | uses: SethCohen/github-releases-to-discord@v1.16.2 23 | with: 24 | webhook_url: ${{ secrets.DISCORD_WEBHOOK }} 25 | - name: on-success 26 | if: github.event.workflow_run.conclusion == 'success' 27 | uses: Ilshidur/action-discord@master 28 | with: 29 | args: | 30 | Github repo: ${{ github.repository }} 31 | - Branch: ${{ github.event.workflow_run.head_branch }} 32 | - [Link: to Actions](<${{ github.event.workflow_run.html_url }}>) 33 | - Status: 🎉 ${{ github.event.workflow_run.conclusion }} 🍏 34 | - name: on-failure 35 | if: github.event.workflow_run.conclusion == 'failure' 36 | uses: Ilshidur/action-discord@master 37 | with: 38 | args: | 39 | Github repo: ${{ github.repository }} 40 | - Branch: ${{ github.event.workflow_run.head_branch }} 41 | - [Link: to Actions](<${{ github.event.workflow_run.html_url }}>) 42 | - Status: 🤔 ${{ github.event.workflow_run.conclusion }} 💣💥 43 | -------------------------------------------------------------------------------- /.github/workflows/issue-label.yml: -------------------------------------------------------------------------------- 1 | name: Issue labels 2 | 3 | on: 4 | issues: 5 | types: [labeled, reopened, closed, deleted] 6 | 7 | env: 8 | DISCORD_WEBHOOK: ${{ secrets.DISCORD_ISSUES_WEBHOOK }} 9 | 10 | jobs: 11 | labelNotify: 12 | runs-on: ubuntu-latest 13 | timeout-minutes: 5 14 | steps: 15 | - name: notify on label 16 | if: > 17 | github.event.label.name == 'enhancement' 18 | || github.event.label.name == 'bug' 19 | || github.event.label.name == 'help wanted' 20 | || github.event.label.name == 'priority/high' 21 | || github.event.label.name == 'question' 22 | || github.event.label.name == 'status/waiting on upstream' 23 | uses: Ilshidur/action-discord@master 24 | with: 25 | args: "[${{ github.event.issue.title }} (#${{ github.event.issue.number }})](<${{ github.event.issue.html_url }}>) added `${{ github.event.label.name }}` label" 26 | - name: notify on action change 27 | if: > 28 | github.event.action == 'closed' 29 | || github.event.action == 'reopened' 30 | || github.event.action == 'deleted' 31 | uses: Ilshidur/action-discord@master 32 | with: 33 | args: "[${{ github.event.issue.title }} (#${{ github.event.issue.number }})](<${{ github.event.issue.html_url }}>) has been `${{ github.event.action }}` by `${{ github.event.sender.login }}`" 34 | -------------------------------------------------------------------------------- /.github/workflows/stale-check.yml: -------------------------------------------------------------------------------- 1 | name: Stale Check 2 | 3 | on: 4 | schedule: 5 | - cron: 0 2 * * * 6 | 7 | jobs: 8 | check: 9 | runs-on: ubuntu-22.04 10 | permissions: 11 | issues: write 12 | pull-requests: write 13 | steps: 14 | - name: Process Stale Issues 15 | uses: actions/stale@v9 16 | with: 17 | stale-issue-label: status/stale 18 | stale-pr-label: status/stale 19 | stale-issue-message: > 20 | This issue is stale because it has been open 30 days with no activity. 21 | Please add a comment describing the reason to keep this issue open. 22 | days-before-stale: 30 23 | days-before-close: 5 24 | exempt-issue-labels: 'enhancement,keep,status/needs triage,priority/high' 25 | 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | /data/ 3 | /.idea/ 4 | *.iml 5 | /gh-md-toc 6 | personal-build-and-develop.* 7 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 2 | version: 2 3 | 4 | build: 5 | os: ubuntu-22.04 6 | tools: 7 | python: "3.11" 8 | 9 | mkdocs: 10 | configuration: mkdocs.yml 11 | 12 | python: 13 | install: 14 | - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /bin/mc-health: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=../scripts/start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | if [ -f /data/.mc-health.env ]; then 6 | . /data/.mc-health.env 7 | fi 8 | 9 | if isTrue "${DISABLE_HEALTHCHECK}"; then 10 | echo "Healthcheck disabled" 11 | exit 0 12 | elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then 13 | echo "Java process suspended by Autopause function" 14 | exit 0 15 | else 16 | mc-monitor status "${MC_HEALTH_EXTRA_ARGS[@]}" --host "${SERVER_HOST:-localhost}" --port "${SERVER_PORT:-25565}" 17 | exit $? 18 | fi 19 | -------------------------------------------------------------------------------- /bin/mc-send-to-console: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | . "/start-utils" 3 | : "${CONSOLE_IN_NAMED_PIPE:=/tmp/minecraft-console-in}" 4 | 5 | if isFalse "${CREATE_CONSOLE_IN_PIPE:-false}"; then 6 | error "Console pipe needs to be enabled by setting CREATE_CONSOLE_IN_PIPE to true" 7 | fi 8 | 9 | 10 | if [ $# = 0 ]; then 11 | error "Pass console commands as arguments" 12 | exit 1 13 | fi 14 | 15 | if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then 16 | error "Named pipe ${CONSOLE_IN_NAMED_PIPE} is missing" 17 | exit 1 18 | fi 19 | 20 | if [[ "$(id -u)" = 0 ]] && [[ $UID != 0 ]]; then 21 | error "Exec needs to be run with user ID $UID" 22 | exit 2 23 | else 24 | echo "$@" >"${CONSOLE_IN_NAMED_PIPE}" 25 | fi 26 | -------------------------------------------------------------------------------- /bin/mcstatus: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | warning "mcstatus is deprecated; calling mc-monitor instead" 4 | 5 | ##### mcstatus shim for mc-monitor 6 | # handles translating calls to 7 | # mcstatus (host:port) (command) 8 | # where the actual command is ignore, but is typically ping or status 9 | 10 | addr="$1" 11 | 12 | IFS=':' 13 | read -a parts <<< "${addr}" 14 | args=(--host ${parts[0]}) 15 | if [[ ${#parts[*]} -gt 1 ]]; then 16 | args+=(--port ${parts[1]}) 17 | fi 18 | exec mc-monitor ${args[@]} -------------------------------------------------------------------------------- /build/alpine/install-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -o pipefail 5 | 6 | # Install necessary packages 7 | # shellcheck disable=SC2086 8 | apk add --no-cache -U \ 9 | openssl \ 10 | imagemagick \ 11 | file \ 12 | lsof \ 13 | su-exec \ 14 | coreutils \ 15 | findutils \ 16 | procps \ 17 | shadow \ 18 | bash \ 19 | curl \ 20 | iputils \ 21 | git \ 22 | jq \ 23 | mysql-client \ 24 | tzdata \ 25 | rsync \ 26 | nano \ 27 | ncurses \ 28 | sudo \ 29 | tar \ 30 | zstd \ 31 | nfs-utils \ 32 | libpcap \ 33 | libwebp \ 34 | libcap \ 35 | ${EXTRA_ALPINE_PACKAGES} 36 | 37 | # Download and install patched knockd 38 | curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-alpine-amd64.tar.gz 39 | tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz 40 | ln -s /usr/local/sbin/knockd /usr/sbin/knockd 41 | setcap cap_net_raw=ep /usr/local/sbin/knockd 42 | 43 | # Set Git credentials globally 44 | cat <> /etc/gitconfig 45 | [user] 46 | name = Minecraft Server on Docker 47 | email = server@example.com 48 | EOF -------------------------------------------------------------------------------- /build/alpine/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | addgroup -g 1000 minecraft 6 | adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft 7 | -------------------------------------------------------------------------------- /build/ol/install-gosu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | GOSU_VERSION="1.16" 6 | GOSU_BASE_URL="https://github.com/tianon/gosu/releases/download/$GOSU_VERSION" 7 | 8 | case $(uname -m) in 9 | "aarch64") 10 | GOSU_ARCH="gosu-arm64" 11 | ;; 12 | "x86_64") 13 | GOSU_ARCH="gosu-amd64" 14 | ;; 15 | *) 16 | echo "Architecture not supported!" 17 | exit 1 18 | ;; 19 | esac 20 | 21 | curl -sL -o /bin/gosu "${GOSU_BASE_URL}/${GOSU_ARCH}" 22 | chmod +x /bin/gosu 23 | -------------------------------------------------------------------------------- /build/ol/install-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export TARGET 4 | 5 | set -euo pipefail 6 | 7 | os_major_version=$(awk -F'[= ."]+' '/^VERSION_ID=/{ print $2 }' /etc/os-release) 8 | 9 | # Install and configure dnf 10 | microdnf install dnf -y 11 | dnf install 'dnf-command(config-manager)' -y 12 | dnf config-manager --set-enabled ol${os_major_version}_codeready_builder 13 | 14 | # Add EPEL repository 15 | tee /etc/yum.repos.d/ol${os_major_version}-epel.repo <> /etc/gitconfig 73 | [user] 74 | name = Minecraft Server on Docker 75 | email = server@example.com 76 | EOF 77 | -------------------------------------------------------------------------------- /build/ol/setup-user.sh: -------------------------------------------------------------------------------- 1 | groupadd --gid 1000 minecraft 2 | useradd --system --shell /bin/false --uid 1000 -g minecraft --home /data minecraft 3 | -------------------------------------------------------------------------------- /build/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g') 6 | 7 | "$(dirname "$0")/${distro}/$1".sh -------------------------------------------------------------------------------- /build/ubuntu/install-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export TARGET 4 | 5 | set -euo pipefail 6 | 7 | # Update and install packages 8 | apt-get update 9 | # shellcheck disable=SC2086 10 | DEBIAN_FRONTEND=noninteractive \ 11 | apt-get install -y \ 12 | imagemagick \ 13 | file \ 14 | gosu \ 15 | sudo \ 16 | net-tools \ 17 | iputils-ping \ 18 | curl \ 19 | git \ 20 | jq \ 21 | dos2unix \ 22 | mysql-client \ 23 | tzdata \ 24 | rsync \ 25 | nano \ 26 | unzip \ 27 | zstd \ 28 | lbzip2 \ 29 | nfs-common \ 30 | libpcap0.8 \ 31 | ${EXTRA_DEB_PACKAGES} 32 | 33 | # Install Git LFS 34 | curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash 35 | apt-get update 36 | apt-get install -y git-lfs 37 | 38 | # Clean up APT when done 39 | apt-get clean 40 | 41 | # Download and install patched knockd 42 | curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz 43 | tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz 44 | ln -s /usr/local/sbin/knockd /usr/sbin/knockd 45 | setcap cap_net_raw=ep /usr/local/sbin/knockd 46 | find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \; 47 | 48 | # Set git credentials globally 49 | cat <> /etc/gitconfig 50 | [user] 51 | name = Minecraft Server on Docker 52 | email = server@example.com 53 | EOF 54 | -------------------------------------------------------------------------------- /build/ubuntu/setup-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if id ubuntu > /dev/null 2>&1; then 6 | deluser ubuntu 7 | fi 8 | 9 | addgroup --gid 1000 minecraft 10 | adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft -------------------------------------------------------------------------------- /docker-compose-mkdocs.yml: -------------------------------------------------------------------------------- 1 | # This composition can be used to serve up the rendered mkdocs for local authoring. 2 | # 3 | # docker compose -f docker-compose-mkdocs.yml -p mkdocs up 4 | # 5 | # and then access http://localhost:8000 6 | 7 | services: 8 | mkdocs: 9 | build: 10 | context: . 11 | dockerfile: docs/Dockerfile 12 | volumes: 13 | - ./mkdocs.yml:/mkdocs/mkdocs.yml 14 | - ./docs:/mkdocs/docs 15 | command: 16 | - serve 17 | - --dev-addr=0.0.0.0:8000 18 | ports: 19 | - "8000:8000" -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: "true" 6 | ports: 7 | - "25565:25565" 8 | volumes: 9 | - data:/data 10 | stdin_open: true 11 | tty: true 12 | restart: unless-stopped 13 | volumes: 14 | data: {} -------------------------------------------------------------------------------- /docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9 2 | 3 | RUN pip install --upgrade pip 4 | 5 | WORKDIR /mkdocs 6 | 7 | RUN --mount=target=/build/requirements.txt,source=docs/requirements.txt \ 8 | pip install -r /build/requirements.txt 9 | 10 | ENTRYPOINT ["mkdocs"] -------------------------------------------------------------------------------- /docs/commands.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Sending commands 3 | --- 4 | 5 | [RCON](http://wiki.vg/RCON) is enabled by default, so you can `exec` into the container to 6 | access the Minecraft server console: 7 | 8 | ``` 9 | docker exec -i mc rcon-cli 10 | ``` 11 | 12 | Note: The `-i` is required for interactive use of rcon-cli. 13 | 14 | To run a simple, one-shot command, such as stopping a Minecraft server, pass the command as arguments to `rcon-cli`, such as: 15 | 16 | ``` 17 | docker exec mc rcon-cli stop 18 | ``` 19 | 20 | _The `-i` is not needed in this case._ 21 | 22 | ## When RCON is disabled 23 | 24 | If rcon is disabled you can send commands by passing them as arguments to the packaged `mc-send-to-console` script after setting the env var `CREATE_CONSOLE_IN_PIPE` to "true". For example, a player can be op'ed in the container `mc` with: 25 | 26 | ```shell 27 | docker exec --user 1000 mc mc-send-to-console op player 28 | | | 29 | +- container name +- Minecraft commands start here 30 | ``` 31 | 32 | ## Enabling interactive console 33 | 34 | In order to attach and interact with the Minecraft server make sure to enable TTY and keep stdin open. 35 | 36 | !!! example 37 | 38 | With `docker run` use the `-it` arguments: 39 | 40 | ```shell 41 | docker run -d -it -p 25565:25565 --name mc itzg/minecraft-server 42 | ``` 43 | 44 | or with a compose file: 45 | 46 | ```yaml 47 | services: 48 | minecraft: 49 | stdin_open: true 50 | tty: true 51 | ``` 52 | 53 | With that you can attach and interact at any time using 54 | 55 | docker attach mc 56 | 57 | and then Control-p Control-q to **detach**. 58 | 59 | !!! info "RCON is required for fully interactive, color console" 60 | 61 | RCON must be enabled, which is the default, in order to use a fully interactive console with auto-completion and colorized log output. -------------------------------------------------------------------------------- /docs/css/extra.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/css/extra.css -------------------------------------------------------------------------------- /docs/img/.gitignore: -------------------------------------------------------------------------------- 1 | /.*.bkp -------------------------------------------------------------------------------- /docs/img/Going from docker run to compose.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/Going from docker run to compose.drawio.png -------------------------------------------------------------------------------- /docs/img/Minecraft server containment.xml: -------------------------------------------------------------------------------- 1 | 1VVNc5swEP01HDMDUiDOMbGd5pK2Ux96VkGAxgJRIRvcX9+VWD40ODOZ1j0Uz9jS2w+t3ts1Ad1W/SfNmvJNZVwGJMz6gO4CQjZRCN8WuAxA8vgwAIUW2QBFM3AQvziCGFecRMZbz9EoJY1ofDBVdc1T42FMa9X5brmS/qkNK/gKOKRMrtHvIjMlolEYzoZXLooSj97EaPjB0mOh1anG8wJCc/cM5oqNudC/LVmmugVE9wHdaqXMsKr6LZeW2pG2Ie7lHetUt+a1+UgAGQLOTJ74WHEiIfQ5E2dbn7kgJ8nPky3q2fDe3DEpijqgT+AheW5mK6wK/HVZ2obVI7ZT6ZFrCHlVrRkdoLSlzwJ2BYwo8WohXSkMPzQstfsOWhCcSlNJ2EX21JFVu8mFlFsllXahdJ/YD+Bnro0AyZ+Gu+yMslnwZjt3LVd/KurCpgptLlWbA5aBXNs0vH+X/mgSFWaFq4obfQEXDKDYBhd/2809RzeIlYt2mxwZ9nkxZZ61hgXKfV16upK+EjBMmuXmruX67KSCATMMYL2SwDU5z5DkvxAE52NNvdHqyBeOoXs8UWIbplP8A3ES3UCVja/K41oVEl5RJYpuoMr9SpU34B+Qr0rD0ITD0JE4TuI/nopwLcKLexYi6OFet6CT3Pt8TjwtCI3IFUJv0eXxis9v2y+fr/D58P/yGf87PmE7v4ycbfHCp/vf -------------------------------------------------------------------------------- /docs/img/cf-file-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/cf-file-id.png -------------------------------------------------------------------------------- /docs/img/cf-project-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/cf-project-id.png -------------------------------------------------------------------------------- /docs/img/cf-slug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/cf-slug.png -------------------------------------------------------------------------------- /docs/img/docs-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/docs-banner.png -------------------------------------------------------------------------------- /docs/img/docs-banner.txt: -------------------------------------------------------------------------------- 1 | Generated at https://textcraft.net/ 2 | 3 | Line 1: 4 | "Click here for" 5 | Small, none, Minecraftia 6 | 7 | Line 2: 8 | "Documentation" 9 | Large, non, Minecrafter 10 | 11 | Overall settings: 12 | - drop shadow -------------------------------------------------------------------------------- /docs/img/example-autocf-downloads.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/example-autocf-downloads.drawio.png -------------------------------------------------------------------------------- /docs/img/ftba-version-id-popup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/ftba-version-id-popup.png -------------------------------------------------------------------------------- /docs/img/level-vs-world.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/level-vs-world.drawio.png -------------------------------------------------------------------------------- /docs/img/modrinth-project-id.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/modrinth-project-id.drawio.png -------------------------------------------------------------------------------- /docs/img/modrinth-project-slug.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/modrinth-project-slug.drawio.png -------------------------------------------------------------------------------- /docs/img/modrinth-version-id.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/modrinth-version-id.drawio.png -------------------------------------------------------------------------------- /docs/img/motd-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/motd-example.png -------------------------------------------------------------------------------- /docs/img/start-script-flow.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/start-script-flow.drawio.png -------------------------------------------------------------------------------- /docs/img/world-copy-compose-project.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/docs/img/world-copy-compose-project.drawio.png -------------------------------------------------------------------------------- /docs/misc/autopause-autostop/autostop.md: -------------------------------------------------------------------------------- 1 | # Auto-Stop 2 | 3 | An option to stop the server after a specified time has been added for niche applications (e.g. billing saving on AWS Fargate). The function is incompatible with the Autopause functionality, as they basically cancel out each other. 4 | 5 | !!! note 6 | 7 | the docker container variables have to be set accordingly (restart policy set to "no") and that the container has to be manually restarted. 8 | 9 | A `.skip-stop` file can be created in the `/data` directory to make the server skip autostopping, for as long as the file is present. The autostop timer will also be reset. 10 | 11 | A starting, example compose file has been provided in [examples/docker-compose-autostop.yml](https://github.com/itzg/docker-minecraft-server/blob/master/examples/docker-compose-autostop.yml). 12 | 13 | Enable the Autostop functionality by setting: 14 | 15 | ``` 16 | -e ENABLE_AUTOSTOP=TRUE 17 | ``` 18 | 19 | The following environment variables define the behavior of auto-stopping: 20 | - `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds) 21 | describes the time between the last client disconnect and the stopping of the server (read as timeout established) 22 | - `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds) 23 | describes the time between server start and the stopping of the server, when no client connects in-between (read as timeout initialized) 24 | - `AUTOSTOP_PERIOD`, default `10` (seconds) 25 | describes period of the daemonized state machine, that handles the stopping of the server 26 | - `AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10 27 | - `AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s 28 | 29 | > To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output 30 | 31 | ## Proxy Support 32 | If you make use of PROXY Protocol, i.e. through something like HAProxy or Fly.io, you will need to enable it in your variety of server's configuration, and then set the `USES_PROXY_PROTOCOL` envar to `true`. This lets Autostop monitor the server, where it otherwise wouldn't 33 | -------------------------------------------------------------------------------- /docs/misc/contributing/building.md: -------------------------------------------------------------------------------- 1 | 2 | ## Building image locally with alternate Java base 3 | 4 | The following shows how to change the base Java image used by the build: 5 | 6 | ```shell 7 | docker build --build-arg BASE_IMAGE=ghcr.io/graalvm/graalvm-ce:ol8-java11 -t IMG_PREFIX/minecraft-server:java11-graalvm . 8 | ``` 9 | 10 | ## Building a multi-architecture image 11 | 12 | Ensure buildx/BuildKit support is enabled and run the following to build multi-architecture and push to the repository as named by the image: 13 | 14 | ```shell 15 | docker buildx build --platform=linux/arm64 --platform=linux/arm/v7 --platform=linux/amd64 --tag IMG_PREFIX/minecraft-server --push . 16 | ``` 17 | 18 | To build for local images, multi-architecture is not supported, use the following with buildx to load the image into the local daemon: 19 | 20 | ```shell 21 | docker buildx build --tag IMG_PREFIX/minecraft-server --load . 22 | ``` 23 | 24 | or just a plain build 25 | 26 | ```shell 27 | docker build -t IMG_PREFIX/minecraft-server . 28 | ``` 29 | 30 | ## Installing extra packages 31 | 32 | The following build args can be set to install additional packages for the respective base image distro: 33 | 34 | - `EXTRA_DEB_PACKAGES` 35 | - `EXTRA_DNF_PACKAGES` 36 | - `EXTRA_ALPINE_PACKAGES` 37 | -------------------------------------------------------------------------------- /docs/misc/contributing/docs.md: -------------------------------------------------------------------------------- 1 | # Site documentation 2 | 3 | The documentation for this image/repository is written in markdown and built by [MkDocs](https://www.mkdocs.org/) into a documentation website hosted at [Read the Docs](https://readthedocs.org/). [Here is general information about writing MkDocs markdown](https://www.mkdocs.org/user-guide/writing-your-docs/) and [specifics for the Material theme used](https://squidfunk.github.io/mkdocs-material/reference/). 4 | 5 | !!! note 6 | The README.md rarely needs to be modified and only serves as a brief introduction to the project. 7 | 8 | The documentation source is maintained in the [docs](https://github.com/itzg/docker-minecraft-server/tree/master/docs) folder and is organized into sections by directory and files. Look through the existing content to determine if an existing file should be updated or a new file/directory added. 9 | 10 | It will be very helpful to view the rendered documentation as you're editing. To do that run the following from the top-level directory: 11 | 12 | ```shell 13 | docker compose -f docker-compose-mkdocs.yml -p mkdocs up 14 | ``` 15 | 16 | You can access the live documentation rendering at . -------------------------------------------------------------------------------- /docs/misc/healthcheck.md: -------------------------------------------------------------------------------- 1 | ## Healthcheck 2 | 3 | This image contains [mc-monitor](https://github.com/itzg/mc-monitor) and uses its `status` command to continually check on the container's. That can be observed from the `STATUS` column of `docker ps` 4 | 5 | ``` 6 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7 | b418af073764 mc "/start" 43 seconds ago Up 41 seconds (healthy) 0.0.0.0:25565->25565/tcp, 25575/tcp mc 8 | ``` 9 | 10 | You can also query the container's health in a script friendly way: 11 | 12 | ``` shell 13 | > docker container inspect -f "{{.State.Health.Status}}" mc 14 | healthy 15 | ``` 16 | 17 | There's actually a wrapper script called `mc-health` that takes care of calling `mc-monitor status` with the correct arguments. If needing to customize the health checks parameters, such as in a compose file, then use something like the following in the service declaration: 18 | 19 | ``` yaml 20 | healthcheck: 21 | test: mc-health 22 | start_period: 1m 23 | interval: 5s 24 | retries: 20 25 | ``` 26 | 27 | Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`. 28 | 29 | ### Healthchecks for older versions 30 | 31 | This container disables Healthchecks for Versions before b1.8 as those versions do not support any kind of server pinging. 32 | For more information see [Server List Ping](https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3) 33 | -------------------------------------------------------------------------------- /docs/misc/log4j.md: -------------------------------------------------------------------------------- 1 | **Please ensure you have pulled the latest image** since [all official mitigations](https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition) are automatically applied by the container startup process. 2 | -------------------------------------------------------------------------------- /docs/misc/raspberrypi.md: -------------------------------------------------------------------------------- 1 | # Running on RaspberryPi 2 | 3 | To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](../versions/java.md) that specify `armv7` for the architecture, which includes `itzg/minecraft-server:latest`. 4 | 5 | !!! note 6 | 7 | You may need to lower the memory allocation, such as `-e MEMORY=750m` 8 | 9 | !!! note 10 | 11 | If experiencing issues such as "sleep: cannot read realtime clock: Operation not permitted", ensure `libseccomp` is up to date on your host. In some cases adding `:Z` flag to the `/data` mount may be needed, [but use cautiously](https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label). 12 | -------------------------------------------------------------------------------- /docs/misc/related-projects.md: -------------------------------------------------------------------------------- 1 | ### [itzg/minecraft-bedrock-server](https://github.com/itzg/docker-minecraft-bedrock-server) 2 | 3 | Docker image that runs a Minecraft Bedrock server. 4 | 5 | ### [mc-router](https://github.com/itzg/mc-router) 6 | 7 | Lightweight multiplexer/proxy for Minecraft Java servers. Provided as a stand-alone application and a Docker image. 8 | 9 | ### [itzg/mc-proxy](https://github.com/itzg/docker-bungeecord/) 10 | 11 | Docker image that runs a proxy powered by Bungeecord, Velocity, or Waterfall 12 | 13 | ### [itzg/mc-backup](https://github.com/itzg/docker-mc-backup) 14 | 15 | Docker image that runs as a side-car container to backup world data. 16 | 17 | ### [rcon-cli](https://github.com/itzg/rcon-cli) 18 | 19 | A tool that is bundled with this image to provide CLI access to an RCON endpoint. 20 | 21 | ### [mc-monitor](https://github.com/itzg/mc-monitor) 22 | 23 | A tool that is bundled with this image that provides health checks and metrics reporting, such as a Prometheus exporter or a telegraf data source. 24 | 25 | ### [mc-image-helper](https://github.com/itzg/mc-image-helper) 26 | 27 | A tool that is bundled with this image to provide complex, re-usable preparation operations. 28 | 29 | ### [itzg/rcon](https://github.com/itzg/docker-rcon-web-admin) 30 | 31 | An image that dockerizes [rcon-web-admin](https://github.com/rcon-web-admin/rcon-web-admin). 32 | -------------------------------------------------------------------------------- /docs/mods-and-plugins/packwiz.md: -------------------------------------------------------------------------------- 1 | # Packwiz Modpacks 2 | 3 | [packwiz](https://packwiz.infra.link/) is a CLI tool for maintaining and providing modpack definitions, with support for both CurseForge and Modrinth as sources. See the [packwiz tutorial](https://packwiz.infra.link/tutorials/getting-started/) for more information. 4 | 5 | To configure server mods using a packwiz modpack, set the `PACKWIZ_URL` environment variable to the location of your `pack.toml` modpack definition: 6 | 7 | ``` 8 | docker run -d -v /path/on/host:/data -e TYPE=FABRIC \ 9 | -e "PACKWIZ_URL=https://example.com/modpack/pack.toml" \ 10 | itzg/minecraft-server 11 | ``` 12 | 13 | packwiz modpack definitions are processed before other mod definitions (`MODPACK`, `MODS`, etc.) to allow for additional processing/overrides you may want to perform (in case of mods not available via Modrinth/CurseForge, or you do not maintain the pack). 14 | 15 | !!! note 16 | 17 | packwiz is pre-configured to only download server mods. If client-side mods are downloaded and cause issues, check your pack.toml configuration, and make sure any client-only mods are not set to `"both"`, but rather `"client"` for the side configuration item. 18 | -------------------------------------------------------------------------------- /docs/mods-and-plugins/spiget.md: -------------------------------------------------------------------------------- 1 | # Auto-download using Spiget 2 | 3 | The `SPIGET_RESOURCES` variable can be set with a comma-separated list of SpigotMC resource IDs to automatically download [Spigot/Bukkit/Paper plugins](https://www.spigotmc.org/resources/) using [the spiget API](https://spiget.org/). Resources that are zip files will be expanded into the plugins directory and resources that are simply jar files will be moved there. 4 | 5 | !!! important "SPIGET not SPIGOT" 6 | The variable is purposely spelled SPIG**E**T with an "E" 7 | 8 | The **resource ID** can be located from the numerical part of the URL after the shortname/slug and a dot. For example, the ID is **28140** from 9 | 10 | https://www.spigotmc.org/resources/luckperms.28140/ 11 | ===== 12 | 13 | For example, the following will auto-download the [LuckPerms](https://www.spigotmc.org/resources/luckperms.28140/) and [Vault](https://www.spigotmc.org/resources/vault.34315/) plugins: 14 | 15 | -e SPIGET_RESOURCES=28140,34315 16 | 17 | !!! note 18 | Some plugins, such as EssentialsX (resource ID 9089), do not permit automated downloads via Spiget. Instead, you will need to pre-download the desired file and supply it to the container, such as using the `/plugins` mount point, described [in the main section](index.md). 19 | 20 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | mkdocs-material == 9.6.14 2 | mkdocs-autorefs == 1.4.2 3 | mkdocstrings[python] == 0.29.1 4 | mkdocs-literate-nav == 0.6.2 5 | mdx-gh-links == 0.4 6 | mkdocs-click == 0.9.0 7 | mkdocs-static-i18n == 1.3.0 -------------------------------------------------------------------------------- /docs/types-and-platforms/index.md: -------------------------------------------------------------------------------- 1 | # Server Types and Modpack Platforms 2 | 3 | Server types can be selected by setting the `TYPE` environment variable to one of the types described in these sections. 4 | 5 | The default server type is [the official software provided by Mojang](https://www.minecraft.net/en-us/download/server), which can be explicitly selected by setting `TYPE` to "VANILLA". 6 | 7 | **From the sections to the left...** 8 | 9 | The **modpack platforms** take a modpack identifier, file, etc and use that to select and download the appropriate version of a mod loader, such as Forge or Fabric, downloading declared mods/plugins, and apply any additional files. The modpack platforms are selected by setting `MODPACK_PLATFORM`; however, for ease of use and backward compatibility, the selection can be set in `TYPE` or `MOD_PLATFORM`. 10 | 11 | The individual **server types** allow for selecting the mod loader / server type and specific versions of those. 12 | 13 | !!! important 14 | For all the server types, the `VERSION` environment variable is used to declare the Minecraft version itself, such as 1.19.4. Each server type will have specific variables for qualifying their version in addition to the Minecraft version. 15 | -------------------------------------------------------------------------------- /docs/types-and-platforms/server-types/quilt.md: -------------------------------------------------------------------------------- 1 | Enable [Quilt server](https://quiltmc.org/) mode by adding a `-e TYPE=QUILT` to your command-line. 2 | 3 | ``` 4 | docker run -d -v /path/on/host:/data \ 5 | -e TYPE=QUILT \ 6 | -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server 7 | ``` 8 | 9 | By default, the container will install the latest [quilt server launcher](https://quiltmc.org/install/server/), using the latest [quilt-installer](https://github.com/QuiltMC/quilt-installer) against the minecraft version you have defined with `VERSION` (defaulting to the latest vanilla release of the game). 10 | 11 | A specific loader or installer version other than the latest can be requested using `QUILT_LOADER_VERSION` and `QUILT_INSTALLER_VERSION` respectively, such as: 12 | 13 | ``` 14 | docker run -d -v /path/on/host:/data ... \ 15 | -e TYPE=QUILT \ 16 | -e QUILT_LOADER_VERSION=0.16.0 \ 17 | -e QUILT_INSTALLER_VERSION=0.4.1 18 | ``` 19 | 20 | !!! note 21 | 22 | If you wish to use an alternative launcher you can: 23 | 24 | - Provide the path to a custom launcher jar available to the container with `QUILT_LAUNCHER`, relative to `/data` (such as `-e QUILT_LAUNCHER=quilt-server-custom.jar`) 25 | - Provide the URL to a custom launcher jar with `QUILT_LAUNCHER_URL` (such as `-e QUILT_LAUNCHER_URL=http://HOST/quilt-server-custom.jar`) 26 | 27 | See the [Working with mods and plugins](../../mods-and-plugins/index.md) section to set up Quilt mods and configuration. 28 | -------------------------------------------------------------------------------- /docs/versions/minecraft.md: -------------------------------------------------------------------------------- 1 | To use a different Minecraft version, pass the `VERSION` environment variable (case sensitive), which can have the value 2 | 3 | - LATEST (the default) 4 | - SNAPSHOT 5 | - a specific version, such as "1.7.9" 6 | - or an alpha and beta version, such as "b1.7.3" (server download might not exist) 7 | 8 | For example, to use the latest snapshot: 9 | 10 | ``` 11 | docker run -d -e VERSION=SNAPSHOT ... 12 | ``` 13 | 14 | or a specific version: 15 | 16 | ``` 17 | docker run -d -e VERSION=1.7.9 ... 18 | ``` 19 | 20 | When using "LATEST" or "SNAPSHOT" an upgrade can be performed by simply restarting the container. 21 | During the next startup, if a newer version is available from the respective release channel, then 22 | the new server jar file is downloaded and used. 23 | 24 | !!! note 25 | 26 | Over time you might see older versions of the server jar remain in the `/data` directory. It is safe to remove those. 27 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | data/ 2 | modpacks/ 3 | .env 4 | downloads/ -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Deployment Examples 2 | 3 | This directory contains various deployment examples of the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image. -------------------------------------------------------------------------------- /examples/aof7/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | MODPACK_PLATFORM: AUTO_CURSEFORGE 7 | # Allocate API key from https://console.curseforge.com/ 8 | # and set in .env file making sure to double up dollar signs, such as 9 | # CF_API_KEY=$$2a$$10$$.... 10 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 11 | CF_API_KEY: ${CF_API_KEY} 12 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-of-fabric-7 13 | # CF_FILENAME_MATCHER: 1.2.2 14 | CF_OVERRIDES_EXCLUSIONS: | 15 | mods/iris*.jar 16 | mods/sodium*.jar 17 | MEMORY: 4G 18 | ports: 19 | - "25565:25565" 20 | volumes: 21 | - mc-data:/data 22 | 23 | volumes: 24 | mc-data: {} 25 | 26 | -------------------------------------------------------------------------------- /examples/atm10/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: true 10 | MOD_PLATFORM: AUTO_CURSEFORGE 11 | # Allocate API key from https://console.curseforge.com/ 12 | # and set in .env file making sure to double up dollar signs, such as 13 | # CF_API_KEY=$$2a$$10$$.... 14 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 15 | CF_API_KEY: ${CF_API_KEY} 16 | CF_SLUG: all-the-mods-10 17 | # Optional: select a specific version/file 18 | # CF_FILENAME_MATCHER: "1.17" 19 | MEMORY: 4G 20 | CF_OVERRIDES_EXCLUSIONS: | 21 | shaderpacks/** 22 | volumes: 23 | # Use managed volume by default, but can change to a relative path like 24 | # ./data:/data 25 | # to use a host directory 26 | - mc-data:/data 27 | volumes: 28 | mc-data: 29 | -------------------------------------------------------------------------------- /examples/atm8/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java17 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8 15 | # CF_FILENAME_MATCHER: "1.1.0" 16 | MEMORY: 4G 17 | volumes: 18 | - mc-data:/data 19 | # Since Docker's default volume driver creates volumes owned by root, this 20 | # init container will change ownership to match final UID of mc service, above 21 | init-filebrowser: 22 | image: filebrowser/filebrowser 23 | entrypoint: sh -c 24 | command: 25 | - "chown -R 1000: /database" 26 | restart: no 27 | volumes: 28 | - filebrowser-db:/database 29 | filebrowser: 30 | image: filebrowser/filebrowser 31 | depends_on: 32 | init-filebrowser: 33 | condition: service_completed_successfully 34 | user: "1000:1000" 35 | environment: 36 | FB_DATABASE: /database/filebrowser.db 37 | volumes: 38 | # Default FB_ROOT is /srv 39 | # In this example, the left-side needs to be the same as /data volume of mc service 40 | - mc-data:/srv 41 | - filebrowser-db:/database 42 | ports: 43 | - "25580:80" 44 | 45 | volumes: 46 | mc-data: {} 47 | filebrowser-db: {} -------------------------------------------------------------------------------- /examples/atm8/filebrowser.json: -------------------------------------------------------------------------------- 1 | { 2 | "port": 80, 3 | "baseURL": "", 4 | "address": "", 5 | "log": "stdout", 6 | "database": "/database/filebrowser.db", 7 | "root": "/srv" 8 | } -------------------------------------------------------------------------------- /examples/atm9/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-9 15 | # Optional: select a specific version/file 16 | #CF_FILENAME_MATCHER: "0.2.34" 17 | MEMORY: 4G 18 | volumes: 19 | - mc-data:/data 20 | 21 | volumes: 22 | mc-data: {} -------------------------------------------------------------------------------- /examples/auto-cf/modpack-manifest/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | MODPACK_PLATFORM: AUTO_CURSEFORGE 7 | # Allocate API key from https://console.curseforge.com/ 8 | # and set in .env file making sure to double up dollar signs, such as 9 | # CF_API_KEY=$$2a$$10$$.... 10 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 11 | CF_API_KEY: ${CF_API_KEY} 12 | CF_MODPACK_MANIFEST: /manifests/manifest.json 13 | CF_SLUG: "custom" 14 | MEMORY: 2G 15 | volumes: 16 | - mc-data:/data 17 | - ./manifests:/manifests:ro 18 | ports: 19 | - "25565:25565" 20 | 21 | volumes: 22 | mc-data: {} 23 | -------------------------------------------------------------------------------- /examples/auto-cf/modpack-manifest/manifests/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "minecraft": { 3 | "version": "1.20.4", 4 | "modLoaders": [ 5 | { 6 | "id": "fabric-0.15.3", 7 | "primary": true 8 | } 9 | ] 10 | }, 11 | "manifestType": "minecraftModpack", 12 | "manifestVersion": 1, 13 | "name": "Custom", 14 | "author": "", 15 | "files": [ 16 | { 17 | "projectID": 351725, 18 | "fileID": 4973035, 19 | "required": true 20 | }, 21 | { 22 | "projectID": 306612, 23 | "fileID": 5010374, 24 | "required": true 25 | } 26 | ], 27 | "overrides": "overrides" 28 | } -------------------------------------------------------------------------------- /examples/auto-cf/using-excludes/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/minecraft-eternal/files/4102634 15 | MEMORY: 4G 16 | volumes: 17 | - mc-data:/data 18 | 19 | volumes: 20 | mc-data: {} -------------------------------------------------------------------------------- /examples/autopause/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | minecraft: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | volumes: 7 | - "mc:/data" 8 | environment: 9 | EULA: "TRUE" 10 | TYPE: PAPER 11 | ENABLE_AUTOPAUSE: "TRUE" 12 | MAX_TICK_TIME: "-1" 13 | # More aggressive settings for demo purposes 14 | AUTOPAUSE_TIMEOUT_INIT: "30" 15 | AUTOPAUSE_TIMEOUT_EST: "10" 16 | JVM_DD_OPTS: "disable.watchdog:true" 17 | restart: unless-stopped 18 | 19 | volumes: 20 | mc: {} 21 | -------------------------------------------------------------------------------- /examples/bettermc/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | MODPACK_PLATFORM: AUTO_CURSEFORGE 7 | # Allocate API key from https://console.curseforge.com/ 8 | # and set in .env file making sure to double up dollar signs, such as 9 | # CF_API_KEY=$$2a$$10$$.... 10 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 11 | CF_API_KEY: ${CF_API_KEY} 12 | CF_SLUG: better-mc-fabric-bmc1 13 | # CF_FILENAME_MATCHER: v18.5 14 | MEMORY: 4G 15 | volumes: 16 | - mc:/data 17 | ports: 18 | - "25565:25565" 19 | 20 | volumes: 21 | mc: {} -------------------------------------------------------------------------------- /examples/bmc4/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | MODPACK_PLATFORM: MODRINTH 7 | # NOTE: v36 doesn't startup correctly 8 | MODRINTH_MODPACK: https://modrinth.com/modpack/better-mc-forge-bmc4/version/v34.5 9 | MODRINTH_OVERRIDES_EXCLUSIONS: | 10 | config/paxi/datapacks/BE_default_endgen_fix* 11 | MODRINTH_FORCE_SYNCHRONIZE: true 12 | MEMORY: 4G 13 | ports: 14 | - "25565:25565" 15 | volumes: 16 | - mc-data:/data 17 | # or use a host directory binding 18 | # - ./data:/data 19 | volumes: 20 | mc-data: -------------------------------------------------------------------------------- /examples/canyon/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8 4 | environment: 5 | EULA: true 6 | TYPE: canyon 7 | VERSION: b1.7.3 8 | ports: 9 | - "25565:25565" 10 | volumes: 11 | - mc-data:/data 12 | volumes: 13 | mc-data: 14 | -------------------------------------------------------------------------------- /examples/cleanroom/compose.yml: -------------------------------------------------------------------------------- 1 | # Provides an example of running CleanroomMC from https://github.com/CleanroomMC/Cleanroom, 2 | # which is a Forge fork 3 | services: 4 | mc: 5 | image: itzg/minecraft-server 6 | environment: 7 | EULA: true 8 | TYPE: FORGE 9 | FORGE_INSTALLER_URL: https://github.com/CleanroomMC/Cleanroom/releases/download/0.2.4-alpha/cleanroom-0.2.4-alpha-installer.jar 10 | ports: 11 | - "25565:25565" 12 | volumes: 13 | - mc-data:/data 14 | volumes: 15 | mc-data: -------------------------------------------------------------------------------- /examples/craftoria/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: true 10 | ALLOW_FLIGHT: true 11 | MOD_PLATFORM: AUTO_CURSEFORGE 12 | # Allocate API key from https://console.curseforge.com/ 13 | # and set in .env file making sure to double up dollar signs, such as 14 | # CF_API_KEY=$$2a$$10$$.... 15 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 16 | CF_API_KEY: ${CF_API_KEY} 17 | CF_SLUG: craftoria 18 | MEMORY: 8G 19 | volumes: 20 | # Use managed volume by default, but can change to a relative path like 21 | # ./data:/data 22 | # to use a host directory 23 | - mc-data:/data 24 | volumes: 25 | mc-data: 26 | -------------------------------------------------------------------------------- /examples/curseforge-files/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | TYPE: FORGE 7 | # Allocate API key from https://console.curseforge.com/ 8 | # and set in .env file making sure to double up dollar signs, such as 9 | # CF_API_KEY=$$2a$$10$$.... 10 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 11 | CF_API_KEY: ${CF_API_KEY} 12 | VERSION: 1.19.2 13 | CURSEFORGE_FILES: | 14 | geckolib 15 | aquaculture 16 | naturalist 17 | ports: 18 | - "25565:25565" -------------------------------------------------------------------------------- /examples/docker-compose-autostop.yml: -------------------------------------------------------------------------------- 1 | services: 2 | minecraft: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | volumes: 7 | - "mc:/data" 8 | environment: 9 | EULA: "TRUE" 10 | ENABLE_AUTOSTOP: "TRUE" 11 | # More aggressive settings for demo purposes 12 | AUTOSTOP_TIMEOUT_INIT: "30" 13 | AUTOSTOP_TIMEOUT_EST: "20" 14 | # Important not to auto-restart the server!!! 15 | restart: "no" 16 | 17 | volumes: 18 | mc: {} 19 | -------------------------------------------------------------------------------- /examples/docker-compose-big.yml: -------------------------------------------------------------------------------- 1 | services: 2 | minecraft: 3 | ports: 4 | - "25565:25565" 5 | volumes: 6 | - "mcbig:/data" 7 | environment: 8 | EULA: "TRUE" 9 | MAX_MEMORY: 32G 10 | MAX_BUILD_HEIGHT: 256 11 | VIEW_DISTANCE: 15 12 | LEVEL_TYPE: LARGEBIOMES 13 | MAX_PLAYERS: 100 14 | CONSOLE: "false" 15 | image: itzg/minecraft-server 16 | restart: always 17 | rcon: 18 | image: itzg/rcon 19 | ports: 20 | - "4326:4326" 21 | - "4327:4327" 22 | volumes: 23 | - "rcon:/opt/rcon-web-admin/db" 24 | 25 | volumes: 26 | mcbig: 27 | rcon: 28 | -------------------------------------------------------------------------------- /examples/docker-compose-curseforge.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:${IMAGE_TAG:-java8} 4 | volumes: 5 | - ./modpacks:/modpacks:ro 6 | - data:/data 7 | environment: 8 | EULA: "true" 9 | TYPE: CURSEFORGE 10 | CF_SERVER_MOD: /modpacks/SIMPLE-SERVER-FILES-0.3.20.zip 11 | # CF_SERVER_MOD: /modpacks/createlive3serverfiles+1.4.2.zip 12 | # CF_SERVER_MOD: /modpacks/Valhelsia+3-3.5.1-SERVER.zip 13 | # CF_SERVER_MOD: https://media.forgecdn.net/files/3012/800/SkyFactory-4_Server_4.2.2.zip 14 | # CF_SERVER_MOD: /modpacks/${MODPACK:-SkyFactory_4_Server_4.1.0.zip} 15 | ports: 16 | - "25565:25565" 17 | 18 | volumes: 19 | data: {} -------------------------------------------------------------------------------- /examples/docker-compose-forge.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | # expose the Minecraft server port outside of container 6 | - "25565:25565" 7 | environment: 8 | # REQUIRED for all types 9 | EULA: "TRUE" 10 | # Set server type (vs the default of vanilla) 11 | TYPE: FORGE 12 | DEBUG: "true" 13 | volumes: 14 | # use a named, managed volume for data volume 15 | - mc_forge:/data 16 | # attach local host directory "mods" in same directory as this compose file 17 | # all mods in this directory get copied into /data/mods at startup 18 | - ./mods:/mods:ro 19 | 20 | volumes: 21 | # declared the named volume, but use default/local storage engine 22 | mc_forge: {} 23 | -------------------------------------------------------------------------------- /examples/docker-compose-generic-pack.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:${IMAGE_TAG:-latest} 4 | volumes: 5 | - data:/data 6 | - ./modpacks:/modpacks:ro 7 | environment: 8 | EULA: "true" 9 | TYPE: FORGE 10 | DEBUG: "${DEBUG:-false}" 11 | VERSION: ${VERSION:-1.17.1} 12 | FORGE_VERSION: ${FORGE_VERSION:-37.0.90} 13 | GENERIC_PACK: /modpacks/${MODPACK:-Server-Files-0.0.21.zip} 14 | REMOVE_OLD_MODS: "${REMOVE_OLD_MODS:-false}" 15 | ports: 16 | - "25565:25565" 17 | 18 | volumes: 19 | data: {} -------------------------------------------------------------------------------- /examples/docker-compose-magma.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: "TRUE" 10 | TYPE: MAGMA 11 | VERSION: 1.16.5 12 | volumes: 13 | - data:/data 14 | volumes: 15 | data: {} -------------------------------------------------------------------------------- /examples/docker-compose-modrinth.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: "TRUE" 10 | TYPE: FABRIC 11 | MODRINTH_PROJECTS: fallingtree 12 | volumes: 13 | - data:/data 14 | 15 | volumes: 16 | data: {} -------------------------------------------------------------------------------- /examples/docker-compose-mods-mount.yml: -------------------------------------------------------------------------------- 1 | services: 2 | minecraft: 3 | image: itzg/minecraft-server 4 | volumes: 5 | - ./data:/data 6 | - ./mods:/mods 7 | ports: 8 | - "25565:25565" 9 | environment: 10 | EULA: "true" 11 | TYPE: "FORGE" 12 | VERSION: "1.19.2" 13 | tty: true 14 | stdin_open: true -------------------------------------------------------------------------------- /examples/docker-compose-mohist.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "TRUE" 8 | TYPE: MOHIST 9 | VERSION: 1.12.2 10 | DEBUG: "true" 11 | volumes: 12 | - data:/data 13 | 14 | volumes: 15 | data: {} 16 | -------------------------------------------------------------------------------- /examples/docker-compose-ngrok.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: "TRUE" 10 | restart: unless-stopped 11 | volumes: 12 | # attach the relative directory 'data' to the container's /data path 13 | - ./data:/data 14 | 15 | ngrok: 16 | image: ngrok/ngrok:latest 17 | command: 18 | - "tcp" 19 | - "mc:25565" 20 | environment: 21 | NGROK_AUTHTOKEN: 22 | ports: 23 | - 4551:4551 -------------------------------------------------------------------------------- /examples/docker-compose-proxied.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | # build: . 4 | image: itzg/minecraft-server 5 | ports: 6 | - 25565:25565 7 | environment: 8 | EULA: "TRUE" 9 | # TYPE: SPIGOT 10 | # VERSION: 1.11.2 11 | PROXY: proxy:3128 12 | proxy: 13 | image: sameersbn/squid 14 | 15 | -------------------------------------------------------------------------------- /examples/docker-compose-rconcmd.yml: -------------------------------------------------------------------------------- 1 | services: 2 | minecraft: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | ports: 5 | - "25565:25565" 6 | volumes: 7 | - "mc:/data" 8 | environment: 9 | EULA: "TRUE" 10 | TYPE: FABRIC 11 | MEMORY: "2G" 12 | CURSEFORGE_FILES: | 13 | fabric-api 14 | chunky-pregenerator 15 | # Allocate API key from https://console.curseforge.com/ 16 | # and set in .env file making sure to double up dollar signs, such as 17 | # CF_API_KEY=$$2a$$10$$.... 18 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 19 | CF_API_KEY: ${CF_API_KEY} 20 | # YAML Heredoc, be sure to use '|-' this will remove the first newline and final new line. 21 | # This is versus '|' that will leaving with two empty strings at top and bottom. 22 | RCON_CMDS_STARTUP: |- 23 | /gamerule doFireTick false 24 | /team add New 25 | /team add Old 26 | /chunky radius 1000 27 | /chunky start 28 | RCON_CMDS_ON_CONNECT: |- 29 | /team join New @a[team=] 30 | /give @a[team=New] birch_boat 31 | /team join Old @a[team=New] 32 | RCON_CMDS_FIRST_CONNECT: |- 33 | /chunky pause 34 | RCON_CMDS_LAST_DISCONNECT: |- 35 | /kill @e[type=minecraft:boat] 36 | /chunky continue 37 | restart: unless-stopped 38 | volumes: 39 | mc: {} 40 | -------------------------------------------------------------------------------- /examples/docker-compose-rlcraft.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8 4 | volumes: 5 | - data:/data 6 | - ./modpacks:/modpacks:ro 7 | environment: 8 | EULA: "true" 9 | TYPE: "FORGE" 10 | VERSION: "1.12.2" 11 | FORGE_VERSION: "14.23.5.2860" 12 | OVERRIDE_SERVER_PROPERTIES: "true" 13 | DIFFICULTY: "hard" 14 | MAX_TICK_TIME: "-1" 15 | ALLOW_FLIGHT: "true" 16 | ENABLE_COMMAND_BLOCK: "true" 17 | VIEW_DISTANCE: "10" 18 | MEMORY: "4G" 19 | # Download from https://www.curseforge.com/minecraft/modpacks/rlcraft and place in modpacks subdir 20 | GENERIC_PACK: "/modpacks/RLCraft+Server+Pack+1.12.2+-+Release+v2.9.1c.zip" 21 | ports: 22 | - 25565:25565 23 | 24 | volumes: 25 | data: 26 | -------------------------------------------------------------------------------- /examples/docker-compose-simple.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: "TRUE" 10 | volumes: 11 | # attach the relative directory 'data' to the container's /data path 12 | - ./data:/data 13 | -------------------------------------------------------------------------------- /examples/docker-compose-spongeforge.yml: -------------------------------------------------------------------------------- 1 | # Forge with Sponge API support. THIS REQUIRES DOWNLOADING SPONGEFORGE. 2 | # Place the SpongeForge jar file in /data/mods. Other Forge mods go here as well. 3 | # Place Sponge mods in /data/mods/plugins. Yes, this is a directory inside the Forge mod directory. Do NOT use /data/plugins. 4 | 5 | services: 6 | minecraft: 7 | image: itzg/minecraft-server:java8 8 | ports: 9 | - "25565:25565" 10 | volumes: 11 | - "mc:/data" 12 | environment: 13 | EULA: "TRUE" 14 | #VERSION: "1.12.2" (Ensure this is compatbile with the version of SpongeForge you are using!) 15 | TYPE: "FORGE" 16 | FORGE_VERSION: "RECOMMENDED" 17 | #FORGE_VERSION: "14.23.5.2807" 18 | CONSOLE: "false" 19 | ENABLE_RCON: "true" 20 | RCON_PASSWORD: "testing" 21 | RCON_PORT: 28016 22 | restart: unless-stopped 23 | rcon: 24 | image: itzg/rcon 25 | ports: 26 | - "4326:4326" 27 | - "4327:4327" 28 | volumes: 29 | - "rcon:/opt/rcon-web-admin/db" 30 | 31 | volumes: 32 | mc: 33 | rcon: 34 | -------------------------------------------------------------------------------- /examples/docker-compose-tailscale.yml: -------------------------------------------------------------------------------- 1 | services: 2 | tailscale-client: 3 | image: tailscale/tailscale:latest 4 | container_name: tailscale 5 | hostname: tailscale-minecraft # This name will be the one on the tailscale network 6 | environment: 7 | TS_AUTHKEY: "tskey-auth-PLACE-YOUR-KEY-HERE" 8 | TS_STATE_DIR: "/var/lib/tailscale" 9 | TS_USERSPACE: "FALSE" # If not using Auto-pause it can be set as true 10 | volumes: 11 | - ./ts-minecraft/state:/var/lib/tailscale 12 | - /dev/net/tun:/dev/net/tun 13 | cap_add: 14 | - net_admin 15 | - sys_module 16 | restart: unless-stopped 17 | # ports: # Not needed, tailscale is directly linking to the container. 18 | # - "25565:25565" 19 | minecraft-server: 20 | image: itzg/minecraft-server 21 | network_mode: container:tailscale 22 | stdin_open: true 23 | tty: true 24 | environment: 25 | EULA: "TRUE" 26 | # ENABLE_AUTOPAUSE: "TRUE" 27 | # AUTOPAUSE_KNOCK_INTERFACE: "tailscale0" 28 | # MAX_TICK_TIME: "-1" 29 | volumes: 30 | - minecraftserver:/data 31 | restart: unless-stopped 32 | 33 | 34 | volumes: 35 | minecraftserver: -------------------------------------------------------------------------------- /examples/docker-compose-world-download.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | - 25565:25565 6 | environment: 7 | EULA: "TRUE" 8 | VERSION: 1.7.2 9 | WORLD: https://www.minecraftmaps.com/survival-maps/cube-survival/download 10 | -------------------------------------------------------------------------------- /examples/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | minecraft: 3 | image: itzg/minecraft-server 4 | stdin_open: true 5 | tty: true 6 | ports: 7 | - "25565:25565" 8 | volumes: 9 | - ./data:/data 10 | environment: 11 | EULA: "TRUE" 12 | restart: unless-stopped 13 | -------------------------------------------------------------------------------- /examples/downloads/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar -------------------------------------------------------------------------------- /examples/fabric-cardboard/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:latest 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: "TRUE" 10 | TYPE: "FABRIC" 11 | MEMORY: 4G 12 | MODRINTH_PROJECTS: | 13 | fabric-api 14 | cardboard:beta 15 | USES_PLUGINS: true 16 | volumes: 17 | - mc-data:/data 18 | - ./plugins:/plugins:ro 19 | volumes: 20 | mc-data: -------------------------------------------------------------------------------- /examples/fabric/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: "true" 6 | TYPE: FABRIC 7 | # VERSION: 1.21.4 8 | # FABRIC_INSTALLER_VERSION: 1.0.1 9 | # FABRIC_LOADER_VERSION: 0.16.10 10 | # Since Fabric server type only includes the loader, most times 11 | # the fabric-api is required for other mods to function 12 | MODRINTH_PROJECTS: | 13 | fabric-api 14 | ports: 15 | - "25565:25565" 16 | volumes: 17 | - fabric:/data 18 | 19 | volumes: 20 | fabric: {} -------------------------------------------------------------------------------- /examples/ftb-evolution/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | # Game port 8 | - "25565:25565/tcp" 9 | environment: 10 | EULA: "TRUE" 11 | TYPE: AUTO_CURSEFORGE 12 | # Allocate API key from https://console.curseforge.com/ 13 | # and set in .env file making sure to double up dollar signs, such as 14 | # CF_API_KEY=$$2a$$10$$.... 15 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 16 | CF_API_KEY: ${CF_API_KEY} 17 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/ftb-evolution 18 | # This modpack includes an override client-side only mod that will prevent the server from starting. 19 | # For more information on override exclusions see: 20 | # https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#excluding-overrides-files 21 | CF_OVERRIDES_EXCLUSIONS: mods/rgp_client*.jar 22 | MEMORY: 6G 23 | volumes: 24 | # attach the relative directory 'data' to the container's /data path 25 | - ./data:/data -------------------------------------------------------------------------------- /examples/ftba/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | # expose the Minecraft server port outside of container 6 | - "25565:25565" 7 | environment: 8 | # REQUIRED for all types 9 | EULA: "TRUE" 10 | # Set server type (vs the default of vanilla) 11 | TYPE: FTBA 12 | # Use Pack ID from https://www.feed-the-beast.com/modpacks/119-ftb-presents-direwolf20-120?tab=about 13 | FTB_MODPACK_ID: "119" 14 | # FTB_MODPACK_VERSION_ID: "" 15 | MEMORY: 4G 16 | volumes: 17 | # use a named, managed volume for data volume 18 | - data:/data 19 | 20 | volumes: 21 | # declared the named volume, but use default/local storage engine 22 | data: {} 23 | -------------------------------------------------------------------------------- /examples/geyser/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: "true" 6 | TYPE: "PAPER" 7 | PLUGINS: | 8 | https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot 9 | https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot 10 | ports: 11 | - "25565:25565" 12 | - "19132:19132/udp" 13 | volumes: 14 | - ./data:/data -------------------------------------------------------------------------------- /examples/gtnh/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | # make sure this java version matches with pack java version 4 | image: itzg/minecraft-server:java21 5 | tty: true 6 | stdin_open: true 7 | ports: 8 | - "25565:25565" 9 | environment: 10 | EULA: "TRUE" 11 | TYPE: CUSTOM 12 | GENERIC_PACKS: GT_New_Horizons_2.7.2_Server_Java_17-21 13 | GENERIC_PACKS_SUFFIX: .zip 14 | GENERIC_PACKS_PREFIX: https://downloads.gtnewhorizons.com/ServerPacks/ 15 | # if this isn't true, then the container tries to download the modpack every run 16 | SKIP_GENERIC_PACK_UPDATE_CHECK: "true" 17 | MEMORY: 6G 18 | # Make sure that this matches what is in your pack's startserver bash file 19 | JVM_OPTS: -Dfml.readTimeout=180 @java9args.txt 20 | CUSTOM_JAR_EXEC: -jar lwjgl3ify-forgePatches.jar nogui 21 | volumes: 22 | # attach a managed volume, change to a relative or absolute host directory if needed 23 | - mc-data:/data 24 | volumes: 25 | mc-data: 26 | -------------------------------------------------------------------------------- /examples/jline/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | environment: 7 | EULA: true 8 | TYPE: FABRIC 9 | MODRINTH_PROJECTS: | 10 | jline4mcdsrv 11 | volumes: 12 | - mc-data:/data 13 | volumes: 14 | mc-data: {} -------------------------------------------------------------------------------- /examples/k8s/using-statefulset.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: StatefulSet 4 | metadata: 5 | labels: 6 | app: mc-example 7 | name: mc-example 8 | spec: 9 | replicas: 1 10 | serviceName: mc-example 11 | selector: 12 | matchLabels: 13 | app: mc-example 14 | template: 15 | metadata: 16 | labels: 17 | app: mc-example 18 | spec: 19 | containers: 20 | - name: mc 21 | image: itzg/minecraft-server 22 | imagePullPolicy: Always 23 | env: 24 | - name: EULA 25 | value: "TRUE" 26 | volumeMounts: 27 | - mountPath: /data 28 | name: data 29 | readinessProbe: 30 | exec: 31 | command: 32 | - mc-monitor 33 | - status 34 | - --host 35 | - localhost 36 | - --port 37 | - "25565" 38 | initialDelaySeconds: 30 39 | periodSeconds: 5 40 | failureThreshold: 18 41 | volumeClaimTemplates: 42 | - metadata: 43 | name: data 44 | spec: 45 | accessModes: 46 | - ReadWriteOnce 47 | resources: 48 | requests: 49 | storage: 1Gi 50 | --- 51 | apiVersion: v1 52 | kind: Service 53 | metadata: 54 | labels: 55 | service: mc-example 56 | name: mc-example 57 | spec: 58 | ports: 59 | - port: 25565 60 | targetPort: 25565 61 | selector: 62 | app: mc-example 63 | type: NodePort 64 | -------------------------------------------------------------------------------- /examples/k8s/vanilla-deployment.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: mc-vanilla 5 | spec: 6 | type: NodePort 7 | ports: 8 | - port: 25565 9 | nodePort: 30000 10 | selector: 11 | app: mc-vanilla 12 | --- 13 | apiVersion: apps/v1 14 | kind: Deployment 15 | metadata: 16 | name: mc-vanilla 17 | spec: 18 | selector: 19 | matchLabels: 20 | app: mc-vanilla 21 | template: 22 | metadata: 23 | labels: 24 | app: mc-vanilla 25 | spec: 26 | containers: 27 | - image: itzg/minecraft-server 28 | name: mc-vanilla 29 | env: 30 | # Use secret in real usage 31 | - name: EULA 32 | value: "true" 33 | ports: 34 | - containerPort: 25565 35 | name: main 36 | readinessProbe: 37 | exec: 38 | command: [ "/usr/local/bin/mc-monitor", "status", "--host", "localhost" ] 39 | # Give it i + p * f seconds to be ready, so 120 seconds 40 | initialDelaySeconds: 20 41 | periodSeconds: 5 42 | failureThreshold: 20 43 | # Monitor ongoing liveness 44 | livenessProbe: 45 | exec: 46 | command: ["/usr/local/bin/mc-monitor", "status", "--host", "localhost"] 47 | initialDelaySeconds: 120 48 | periodSeconds: 60 49 | volumeMounts: 50 | - name: mc-data 51 | mountPath: /data 52 | volumes: 53 | - name: mc-data 54 | emptyDir: {} 55 | -------------------------------------------------------------------------------- /examples/ketting/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | TYPE: KETTING 7 | VERSION: 1.20.1 8 | # Allocate API key from https://console.curseforge.com/ 9 | # and set in .env file making sure to double up dollar signs, such as 10 | # CF_API_KEY=$$2a$$10$$.... 11 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 12 | CF_API_KEY: "${CF_API_KEY}" 13 | CURSEFORGE_FILES: https://www.curseforge.com/minecraft/mc-mods/aquaculture 14 | ports: 15 | - "25565:25565" -------------------------------------------------------------------------------- /examples/lazytainer/docker_compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | lazytainer: 3 | image: ghcr.io/vmorganp/lazytainer:master 4 | environment: 5 | VERBOSE: false 6 | ports: 7 | - 25565:25565 8 | volumes: 9 | - /var/run/docker.sock:/var/run/docker.sock:ro 10 | labels: 11 | - lazytainer.group.minecraft.sleepMethod=stop 12 | - lazytainer.group.minecraft.ports=25565 13 | - lazytainer.group.minecraft.minPacketThreshold=2 # Start after two incomming packets 14 | - lazytainer.group.minecraft.inactiveTimeout=600 # 10 minutes, to allow the server to bootstrap. You can probably make this lower later if you want. 15 | restart: unless-stopped 16 | network_mode: bridge 17 | mc: 18 | image: itzg/minecraft-server 19 | environment: 20 | EULA: TRUE 21 | TYPE: PAPER 22 | MEMORY: 4G 23 | volumes: 24 | - ./data:/data 25 | labels: 26 | - lazytainer.group=minecraft 27 | depends_on: 28 | - lazytainer 29 | network_mode: service:lazytainer 30 | tty: true 31 | stdin_open: true 32 | restart: unless-stopped 33 | -------------------------------------------------------------------------------- /examples/modpacks/.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | -------------------------------------------------------------------------------- /examples/modpacks/README.md: -------------------------------------------------------------------------------- 1 | Place server [modpacks downloaded from CurseForge](https://www.curseforge.com/minecraft/modpacks) in this directory. 2 | 3 | The example [`docker-compose-curseforge.yml`](../docker-compose-curseforge.yml) references a modpack downloaded from . 4 | -------------------------------------------------------------------------------- /examples/modrinth-modpack/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | - "25565:25565" 8 | environment: 9 | EULA: "TRUE" 10 | MODPACK_PLATFORM: MODRINTH 11 | MODRINTH_MODPACK: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2 12 | # or for auto-upgrading to latest 13 | # MODRINTH_MODPACK: https://modrinth.com/modpack/cobblemon-fabric 14 | # or just cobblemon-fabric or 5FFgwNNP 15 | # and could replace version URL with 16 | # MODRINTH_VERSION: nvrqJg44 17 | # MODRINTH_VERSION: 1.3.2 18 | # MODRINTH_VERSION: "Cobblemon [Fabric] 1.3.2" 19 | volumes: 20 | # attach the relative directory 'data' to the container's /data path 21 | - ./data:/data 22 | -------------------------------------------------------------------------------- /examples/modrinth-paper/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: "true" 6 | TYPE: PAPER 7 | VERSION: 1.19.3 8 | MODRINTH_PROJECTS: "coreprotect" 9 | MODRINTH_ALLOWED_VERSION_TYPE: "release" 10 | volumes: 11 | - ./data:/data 12 | -------------------------------------------------------------------------------- /examples/modrinth/local-modpack/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | MODPACK_PLATFORM: MODRINTH 7 | # Download the mrpack file from https://modrinth.com/modpack/cobblemon-fabric/version/1.4.1 and place in 8 | # modpacks directory next to this compose file. 9 | MODRINTH_MODPACK: /modpacks/Cobblemon Modpack [Fabric] 1.4.1.mrpack 10 | ports: 11 | - "25565:25565" 12 | volumes: 13 | - mc-data:/data 14 | - ./modpacks:/modpacks:ro 15 | 16 | volumes: 17 | mc-data: {} 18 | -------------------------------------------------------------------------------- /examples/mods-file/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: "true" 6 | TYPE: FORGE 7 | VERSION: 1.15.2 8 | MODS_FILE: /extras/mods.txt 9 | REMOVE_OLD_MODS: "true" 10 | ports: 11 | - "25565:25565" 12 | volumes: 13 | - data:/data 14 | - ./mods.txt:/extras/mods.txt:ro 15 | 16 | volumes: 17 | data: 18 | -------------------------------------------------------------------------------- /examples/multi-project/README.md: -------------------------------------------------------------------------------- 1 | This project demonstrates the use of two compose projects, `dbs` and `servers`, where the following capabilities are demonstrated: 2 | 3 | - Managing databases, such as MariaDB, in its own compose project: `dbs` 4 | - Using an `.env` file to avoid including user details within the compose file 5 | - Accessing the database from a separate project, `servers`, via an external network declaration 6 | - LuckPerms is configured to access the MariaDB instance 7 | - Isolating the Minecraft server container by purposely **not** declaring port mappings 8 | - Running Waterfall as a proxy 9 | - Using configuration mount points to pre-configure Waterfall and the Minecraft server 10 | - Using Spiget to download plugins, in this case LuckPerms -------------------------------------------------------------------------------- /examples/multi-project/dbs/.env: -------------------------------------------------------------------------------- 1 | LUCKPERMS_USER=luckperms 2 | LUCKPERMS_PASSWORD=luckpermspw -------------------------------------------------------------------------------- /examples/multi-project/dbs/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mariadb: 3 | image: mariadb:10 4 | environment: 5 | MARIADB_RANDOM_ROOT_PASSWORD: yes 6 | MARIADB_DATABASE: luckperms 7 | # These are loaded by compose from .env 8 | MARIADB_USER: ${LUCKPERMS_USER} 9 | MARIADB_PASSWORD: ${LUCKPERMS_PASSWORD} 10 | volumes: 11 | - mariadb:/var/lib/mysql 12 | 13 | adminer: 14 | image: adminer 15 | ports: 16 | - "8806:8080" 17 | 18 | volumes: 19 | mariadb: {} -------------------------------------------------------------------------------- /examples/multi-project/servers/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | proxy: 3 | image: itzg/mc-proxy 4 | environment: 5 | TYPE: WATERFALL 6 | ports: 7 | - "25565:25577" 8 | volumes: 9 | - waterfall:/server 10 | - ./waterfall-config:/config 11 | # If you want to use Velocity here is a premade version that supports Velocity 12 | # velocity-proxy: 13 | # image: itzg/mc-proxy 14 | # environment: 15 | # TYPE: VELOCITY 16 | # ports: 17 | # - "25565:25577" 18 | # volumes: 19 | # - velocity:/server 20 | # - ./velocity-config:/config 21 | mc: 22 | image: itzg/minecraft-server 23 | environment: 24 | EULA: "true" 25 | TYPE: PAPER 26 | # 28140: luckperms 27 | SPIGET_RESOURCES: "28140" 28 | # since we're behind a proxy 29 | ONLINE_MODE: "false" 30 | volumes: 31 | - mc:/data 32 | # mainly to drop in config files specific to plugins 33 | - ./mc-plugins:/plugins 34 | networks: 35 | # so proxy can reach us 36 | - default 37 | # so we can use databases project 38 | - dbs 39 | 40 | volumes: 41 | mc: {} 42 | waterfall: {} 43 | 44 | networks: 45 | dbs: 46 | # declared in ../dbs 47 | external: true 48 | name: dbs_default 49 | -------------------------------------------------------------------------------- /examples/multi-project/servers/waterfall-config/config.yml: -------------------------------------------------------------------------------- 1 | server_connect_timeout: 5000 2 | enforce_secure_profile: false 3 | remote_ping_cache: -1 4 | forge_support: true 5 | player_limit: -1 6 | permissions: 7 | default: 8 | - bungeecord.command.server 9 | - bungeecord.command.list 10 | admin: 11 | - bungeecord.command.alert 12 | - bungeecord.command.end 13 | - bungeecord.command.ip 14 | - bungeecord.command.reload 15 | - bungeecord.command.kick 16 | timeout: 30000 17 | log_commands: false 18 | network_compression_threshold: 256 19 | online_mode: true 20 | disabled_commands: 21 | - disabledcommandhere 22 | servers: 23 | mc: 24 | motd: 'Lobby' 25 | address: mc:25565 26 | restricted: false 27 | listeners: 28 | - query_port: 25577 29 | motd: '&1Another Bungee server' 30 | tab_list: GLOBAL_PING 31 | query_enabled: false 32 | proxy_protocol: false 33 | forced_hosts: 34 | pvp.md-5.net: pvp 35 | ping_passthrough: false 36 | priorities: 37 | - mc 38 | bind_local_address: true 39 | host: 0.0.0.0:25577 40 | max_players: 1 41 | tab_size: 60 42 | force_default_server: false 43 | ip_forward: false 44 | remote_ping_timeout: 5000 45 | prevent_proxy_connections: false 46 | groups: 47 | md_5: 48 | - admin 49 | connection_throttle: 4000 50 | stats: 39440d41-8d83-40cb-a6a7-d95c3197c4d2 51 | connection_throttle_limit: 3 52 | log_pings: true 53 | -------------------------------------------------------------------------------- /examples/multi-project/servers/waterfall-config/waterfall.yml: -------------------------------------------------------------------------------- 1 | plugin_channel_name_limit: 128 2 | use_netty_dns_resolver: true 3 | disable_modern_tab_limiter: true 4 | log_initial_handler_connections: true 5 | throttling: 6 | tab_complete: 1000 7 | game_version: '' 8 | disable_tab_list_rewrite: true 9 | registered_plugin_channels_limit: 128 10 | disable_entity_metadata_rewrite: false 11 | -------------------------------------------------------------------------------- /examples/multiline-motd/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | MOTD: | 7 | A §l§cMinecraft§r server 8 | line two 9 | # or 10 | # MOTD: "line one\nline two" 11 | ports: 12 | - "25565:25565" -------------------------------------------------------------------------------- /examples/neoforge/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | TYPE: NEOFORGE 7 | VERSION: latest 8 | NEOFORGE_VERSION: beta 9 | ports: 10 | - "25565:25565" 11 | volumes: 12 | - mc:/data 13 | volumes: 14 | mc: {} -------------------------------------------------------------------------------- /examples/one-block-modded/.gitignore: -------------------------------------------------------------------------------- 1 | /.env -------------------------------------------------------------------------------- /examples/one-block-modded/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_SLUG: one-block-modded 15 | # Modpack client zip must be manually downloaded from 16 | # https://www.curseforge.com/minecraft/modpacks/one-block-modded 17 | # due to authors disallowing project distribution 18 | CF_MODPACK_ZIP: /modpacks/Modded+OneBlock.zip 19 | CF_SET_LEVEL_FROM: OVERRIDES 20 | DEBUG: "false" 21 | MEMORY: 4G 22 | volumes: 23 | - mc-data:/data 24 | - ./modpacks:/modpacks:ro 25 | 26 | volumes: 27 | mc-data: {} 28 | -------------------------------------------------------------------------------- /examples/optimized-paper-config/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | container_name: paper 5 | environment: 6 | EULA: "true" 7 | TYPE: "PAPER" 8 | VIEW_DISTANCE: 10 9 | MEMORY: 2G 10 | PAPER_CONFIG_REPO: "https://raw.githubusercontent.com/Alpha018/paper-config-optimized/main" 11 | ports: 12 | - "25565:25565" 13 | volumes: 14 | - mc-paper:/data 15 | restart: unless-stopped 16 | volumes: 17 | mc-paper: {} 18 | -------------------------------------------------------------------------------- /examples/paper/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | environment: 7 | EULA: "true" 8 | TYPE: PAPER 9 | MEMORY: 2G 10 | ports: 11 | - "25565:25565" 12 | volumes: 13 | - mc-data:/data 14 | restart: unless-stopped 15 | volumes: 16 | mc-data: {} 17 | -------------------------------------------------------------------------------- /examples/paper/paper-build-plugins/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM itzg/minecraft-server 2 | 3 | ENV TYPE=PAPER 4 | 5 | COPY plugins/*.jar /plugins/ -------------------------------------------------------------------------------- /examples/paper/paper-build-plugins/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | build: . 4 | environment: 5 | EULA: "TRUE" 6 | ports: 7 | - 25565:25565 8 | stdin_open: true 9 | tty: true -------------------------------------------------------------------------------- /examples/paper/paper-build-plugins/plugins/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar -------------------------------------------------------------------------------- /examples/paper/paper-build-plugins/plugins/README.md: -------------------------------------------------------------------------------- 1 | Download Bukkit/Spigot plugin jars, such as [WorldEdit](https://dev.bukkit.org/projects/worldedit/files) and place them here. At image build time the `COPY` step will place those jars in `/plugins`. At container startup, the contents of `/plugins` are sync'ed into `/data/plugins` for use with Bukkit/Spigot/Paper server types. -------------------------------------------------------------------------------- /examples/paper/paper-proxy-protocol/config/paper-global.yml: -------------------------------------------------------------------------------- 1 | proxies: 2 | proxy-protocol: true -------------------------------------------------------------------------------- /examples/paper/paper-proxy-protocol/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | TYPE: PAPER 7 | ports: 8 | # Use host port 25566 assuming mc-router or similar is bound to 25565 9 | - "25566:25565" 10 | volumes: 11 | - mc-data:/data 12 | - ./config:/config:ro 13 | 14 | volumes: 15 | mc-data: {} -------------------------------------------------------------------------------- /examples/pixelmon/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8-multiarch 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_SLUG: the-pixelmon-modpack 15 | CF_FILENAME_MATCHER: "9.1.2" 16 | MEMORY: 4G 17 | volumes: 18 | - mc-data:/data 19 | 20 | volumes: 21 | mc-data: {} -------------------------------------------------------------------------------- /examples/prominence2/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/prominence-2-rpg 15 | CF_FILENAME_MATCHER: "2.8.7" 16 | MEMORY: 4G 17 | volumes: 18 | - mc-data:/data 19 | 20 | volumes: 21 | mc-data: {} -------------------------------------------------------------------------------- /examples/quilt/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: "true" 6 | TYPE: QUILT 7 | ports: 8 | - "25565:25565" 9 | volumes: 10 | - data:/data 11 | 12 | volumes: 13 | data: {} -------------------------------------------------------------------------------- /examples/rad2/compose.yaml: -------------------------------------------------------------------------------- 1 | # This runs the most recent version of Roguelike Adventures and Dungeons 2. Version 1.11 as of writing. 2 | services: 3 | mc: 4 | image: itzg/minecraft-server:java8 5 | ports: 6 | - "25565:25565" 7 | environment: 8 | EULA: "true" 9 | MODPACK_PLATFORM: AUTO_CURSEFORGE 10 | # Allocate API key from https://console.curseforge.com/ 11 | # and set in .env file making sure to double up dollar signs, such as 12 | # CF_API_KEY=$$2a$$10$$.... 13 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 14 | CF_API_KEY: ${CF_API_KEY} 15 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/roguelike-adventures-and-dungeons-2 16 | # Optional: select a specific version/file 17 | #CF_FILENAME_MATCHER: "0.2.34" 18 | CF_EXCLUDE_MODS: | 19 | creative-core 20 | default-options 21 | itemphysic-lite 22 | konkrete 23 | oauth 24 | CF_FORCE_SYNCHRONIZE: "true" 25 | MEMORY: 4G 26 | volumes: 27 | - mc-data:/data 28 | 29 | volumes: 30 | mc-data: {} 31 | -------------------------------------------------------------------------------- /examples/rlcraft/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8-multiarch 4 | environment: 5 | EULA: true 6 | MODPACK_PLATFORM: AUTO_CURSEFORGE 7 | # Allocate API key from https://console.curseforge.com/ 8 | # and set in .env file making sure to double up dollar signs, such as 9 | # CF_API_KEY=$$2a$$10$$.... 10 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 11 | CF_API_KEY: ${CF_API_KEY} 12 | CF_SLUG: rlcraft 13 | CF_FILENAME_MATCHER: 2.9.3 14 | CF_FORCE_SYNCHRONIZE: true 15 | MEMORY: 4G 16 | volumes: 17 | - ./data:/data 18 | ports: 19 | - "25565:25565" 20 | -------------------------------------------------------------------------------- /examples/simple-voice-chat/fabric-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | # Game port 8 | - "25565:25565/tcp" 9 | # Voice chat port 10 | - "24454:24454/udp" 11 | environment: 12 | EULA: "TRUE" 13 | TYPE: "FABRIC" 14 | VERSION: "1.21.1" 15 | # This will select the latest version of simple voice chat for 1.21.1. 16 | # You can specify a version by appending :versionID (e.g. simple-voice-chat:anabvqRL) 17 | MODRINTH_PROJECTS: "simple-voice-chat" 18 | MEMORY: 8G 19 | volumes: 20 | # attach the relative directory 'data' to the container's /data path 21 | - ./data:/data -------------------------------------------------------------------------------- /examples/simple-voice-chat/neoforge-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | # Game port 8 | - "25565:25565/tcp" 9 | # Voice chat port 10 | - "24454:24454/udp" 11 | environment: 12 | EULA: "TRUE" 13 | TYPE: "NEOFORGE" 14 | VERSION: "1.21.1" 15 | # This will select the latest version of simple voice chat for 1.21.1. 16 | # You can specify a version by appending :versionID (e.g. simple-voice-chat:anabvqRL) 17 | MODRINTH_PROJECTS: "simple-voice-chat" 18 | MEMORY: 8G 19 | volumes: 20 | # attach the relative directory 'data' to the container's /data path 21 | - ./data:/data -------------------------------------------------------------------------------- /examples/simple-voice-chat/paper-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | tty: true 5 | stdin_open: true 6 | ports: 7 | # Game port 8 | - "25565:25565/tcp" 9 | # Voice chat port 10 | - "24454:24454/udp" 11 | environment: 12 | EULA: "TRUE" 13 | TYPE: "PAPER" 14 | VERSION: "1.21.1" 15 | # This will select the latest version of simple voice chat for 1.21.1. 16 | # You can specify a version by appending :versionID (e.g. simple-voice-chat:anabvqRL) 17 | MODRINTH_PROJECTS: "simple-voice-chat" 18 | MEMORY: 8G 19 | volumes: 20 | # attach the relative directory 'data' to the container's /data path 21 | - ./data:/data -------------------------------------------------------------------------------- /examples/skript/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | TYPE: PAPER 7 | PLUGINS: https://github.com/SkriptLang/Skript/releases/download/2.8.4/Skript.jar 8 | SPIGET_RESOURCES: 103749 9 | ports: 10 | - "25565:25565" -------------------------------------------------------------------------------- /examples/skyfactory5/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | # https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/ 7 | MODPACK_PLATFORM: AUTO_CURSEFORGE 8 | # CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/skyfactory-5/files/6290684 9 | CF_SLUG: skyfactory-5 10 | # Comment out the following to get the latest version or pick a version from 11 | # https://www.curseforge.com/minecraft/modpacks/skyfactory-5/files/all?page=1&pageSize=20 12 | CF_FILENAME_MATCHER: 5.0.8 13 | # Allocate API key from https://console.curseforge.com/ 14 | # and set in .env file making sure to double up dollar signs, such as 15 | # CF_API_KEY=$$2a$$10$$.... 16 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 17 | CF_API_KEY: ${CF_API_KEY} 18 | MEMORY: 4G 19 | ports: 20 | - "25565:25565" 21 | volumes: 22 | - mc-data:/data 23 | volumes: 24 | mc-data: 25 | -------------------------------------------------------------------------------- /examples/spiget/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # NOTE 2 | # This file is purposely named spiget with an "e" since it provides an example of the 3 | # feature https://docker-minecraft-server.readthedocs.io/en/latest/mods-and-plugins/spiget/ 4 | # which uses the Spiget API at https://spiget.org/ 5 | 6 | services: 7 | mc: 8 | image: itzg/minecraft-server 9 | ports: 10 | - "25565:25565" 11 | environment: 12 | EULA: "TRUE" 13 | TYPE: PAPER 14 | SPIGET_RESOURCES: 34315,3836 15 | REMOVE_OLD_MODS: true 16 | volumes: 17 | - ./data:/data 18 | -------------------------------------------------------------------------------- /examples/spigot/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | environment: 5 | EULA: true 6 | TYPE: SPIGOT 7 | VERSION: 1.20.4 8 | ports: 9 | - "25565:25565" 10 | volumes: 11 | - data:/data 12 | volumes: 13 | data: {} 14 | -------------------------------------------------------------------------------- /examples/valhelsia2/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java8-multiarch 4 | volumes: 5 | - data:/data 6 | - ./modpacks:/modpacks:ro 7 | environment: 8 | EULA: "true" 9 | TYPE: FORGE 10 | VERSION: "1.15.2" 11 | GENERIC_PACK: /modpacks/Valhelsia_2-2.3.4-SERVER.zip 12 | MEMORY: "2G" 13 | ports: 14 | - "25565:25565" 15 | healthcheck: 16 | test: NONE 17 | 18 | volumes: 19 | data: {} -------------------------------------------------------------------------------- /examples/valhesia5/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_FORCE_SYNCHRONIZE: "true" 15 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/valhelsia-5/files/4429560 16 | MEMORY: 4G 17 | volumes: 18 | - data:/data 19 | 20 | volumes: 21 | data: {} -------------------------------------------------------------------------------- /examples/vanilla-tweaks/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | vanillatweaks_file: 3 | restart: "no" 4 | image: itzg/minecraft-server 5 | ports: 6 | - "25565:25565/tcp" 7 | environment: 8 | EULA: "TRUE" 9 | VERSION: ${MINECRAFT_VERSION:-LATEST} 10 | VANILLATWEAKS_FILE: /config/vanillatweaks-datapacks.json 11 | REMOVE_OLD_VANILLATWEAKS: "TRUE" 12 | volumes: 13 | - data:/data 14 | - ./vanillatweaks-datapacks.json:/config/vanillatweaks-datapacks.json:ro 15 | vanillatweaks_sharecode: 16 | # port is set to 25566 to not conflict with vanillatweaks_file example 17 | ports: 18 | - "25566:25565/tcp" 19 | restart: "no" 20 | image: itzg/minecraft-server 21 | environment: 22 | EULA: "TRUE" 23 | VERSION: ${MINECRAFT_VERSION:-LATEST} 24 | VANILLATWEAKS_SHARECODE: MGr52E 25 | REMOVE_OLD_VANILLATWEAKS: "TRUE" 26 | vanillatweaks_file_datapacks_and_resourcepacks_and_craftingtweaks: 27 | # port is set to 25567 to not conflict with vanillatweaks_file example 28 | restart: "no" 29 | image: itzg/minecraft-server 30 | ports: 31 | - "25567:25565/tcp" 32 | environment: 33 | EULA: "TRUE" 34 | VERSION: ${MINECRAFT_VERSION:-LATEST} 35 | VANILLATWEAKS_FILE: /config/vanillatweaks-datapacks.json,/config/vanillatweaks-resourcepacks.json,/config/vanillatweaks-craftingtweaks.json 36 | REMOVE_OLD_VANILLATWEAKS: "TRUE" 37 | volumes: 38 | - data:/data 39 | - ./vanillatweaks-datapacks.json:/config/vanillatweaks-datapacks.json:ro 40 | - ./vanillatweaks-resourcepacks.json:/config/vanillatweaks-resourcepacks.json:ro 41 | - ./vanillatweaks-craftingtweaks.json:/config/vanillatweaks-craftingtweaks.json:ro 42 | -------------------------------------------------------------------------------- /examples/vanilla-tweaks/vanillatweaks-craftingtweaks.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "craftingtweaks", 3 | "version": "1.18", 4 | "packs": { 5 | "quality of life": [ 6 | "dropper to dispenser", 7 | "double slabs", 8 | "back to blocks" 9 | ] 10 | }, 11 | "result": "ok" 12 | } -------------------------------------------------------------------------------- /examples/vanilla-tweaks/vanillatweaks-datapacks.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "datapacks", 3 | "version": "1.18", 4 | "packs": { 5 | "survival": [ 6 | "graves", 7 | "multiplayer sleep", 8 | "afk display", 9 | "armor statues", 10 | "unlock all recipes", 11 | "fast leaf decay", 12 | "coordinates hud" 13 | ], 14 | "items": ["armored elytra"] 15 | }, 16 | "result": "ok" 17 | } 18 | -------------------------------------------------------------------------------- /examples/vanilla-tweaks/vanillatweaks-resourcepacks.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "resourcepacks", 3 | "version": "1.18", 4 | "packs": { 5 | "aesthetic": ["CherryPicking", "BlackNetherBricks", "AlternateBlockDestruction"] 6 | }, 7 | "result": "ok" 8 | } -------------------------------------------------------------------------------- /examples/vault-hunters-1-18-2/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: itzg/minecraft-server:java17 4 | ports: 5 | - "25565:25565" 6 | environment: 7 | EULA: "true" 8 | MODPACK_PLATFORM: AUTO_CURSEFORGE 9 | # Allocate API key from https://console.curseforge.com/ 10 | # and set in .env file making sure to double up dollar signs, such as 11 | # CF_API_KEY=$$2a$$10$$.... 12 | # Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key 13 | CF_API_KEY: ${CF_API_KEY} 14 | CF_SLUG: vault-hunters-1-18-2 15 | MOTD: "§4----- §2 Vault Hunters: 1.18.2 §4 -----§r\\n §4------ §e vaulthunters.gg §4------" 16 | MEMORY: 6G # 4G for base server + 2G per player 17 | ALLOW_FLIGHT: true 18 | ENABLE_COMMAND_BLOCK: true 19 | DIFFICULTY: hard 20 | volumes: 21 | - mc-data:/data 22 | 23 | volumes: 24 | mc-data: {} 25 | -------------------------------------------------------------------------------- /files/auto/autopause-fcns.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=../scripts/start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | current_uptime() { 6 | awk '{print $1}' /proc/uptime | cut -d . -f 1 7 | } 8 | 9 | java_running() { 10 | [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] 11 | } 12 | 13 | java_process_exists() { 14 | [[ -n "$(ps -ax -o comm | grep 'java')" ]] 15 | } 16 | 17 | rcon_client_exists() { 18 | [[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]] 19 | } 20 | 21 | use_proxy() { 22 | if isTrue "$USES_PROXY_PROTOCOL"; then 23 | echo "--use-proxy" 24 | fi 25 | } 26 | 27 | use_server_list_ping() { 28 | if [[ "${VERSION^^}" == "LATEST" || "${VERSION^^}" == "SNAPSHOT" ]]; then 29 | # Don't use server-list ping for unknown version 30 | return 1 31 | fi 32 | 33 | if versionLessThan 1.7; then 34 | echo "--use-server-list-ping" 35 | fi 36 | } 37 | 38 | 39 | mc_server_listening() { 40 | mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --timeout 10s >&/dev/null 41 | } 42 | 43 | java_clients_connections() { 44 | local connections 45 | if java_running; then 46 | if ! connections=$(mc-monitor status \ 47 | --host "${SERVER_HOST:-localhost}" \ 48 | --port "$SERVER_PORT" \ 49 | --retry-limit "${AUTOPAUSE_STATUS_RETRY_LIMIT:-10}" --retry-interval "${AUTOPAUSE_STATUS_RETRY_INTERVAL:-2s}" \ 50 | $(use_proxy) $(use_server_list_ping) \ 51 | --show-player-count); then 52 | # consider it a non-zero player count if the ping fails 53 | # otherwise a laggy server with players connected could get paused 54 | connections=1 55 | fi 56 | else 57 | connections=0 58 | fi 59 | echo $connections 60 | } 61 | 62 | java_clients_connected() { 63 | (( $(java_clients_connections) > 0 )) 64 | } 65 | -------------------------------------------------------------------------------- /files/auto/knockd-config.cfg: -------------------------------------------------------------------------------- 1 | [options] 2 | logfile = /dev/null 3 | [unpauseMCServer-server] 4 | sequence = 25565 5 | seq_timeout = 1 6 | command = /auto/resume.sh %IP% 7 | tcpflags = syn 8 | [unpauseMCServer-rcon] 9 | sequence = 25575 10 | seq_timeout = 1 11 | command = /auto/resume.sh %IP% 12 | tcpflags = syn 13 | [unpauseMCServer-bedrock] 14 | sequence = 19132:udp 15 | command = /auto/resume.sh %IP% 16 | seq_cooldown = 60 17 | -------------------------------------------------------------------------------- /files/auto/pause.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /start-utils 4 | if isTrue "${DEBUG_AUTOPAUSE}"; then 5 | set -x 6 | fi 7 | 8 | if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then 9 | # save world 10 | rcon-cli save-all >/dev/null 11 | 12 | # wait until mc-monitor is no longer connected to the server 13 | while : 14 | do 15 | if [[ -z "$(netstat -nt | grep "127.0.0.1:$SERVER_PORT" | grep 'ESTABLISHED')" ]]; then 16 | break 17 | fi 18 | sleep 0.1 19 | done 20 | 21 | # finally pause the process 22 | logAutopauseAction "Pausing Java process" 23 | pkill -STOP java 24 | 25 | # create .paused file in data directory 26 | touch /data/.paused 27 | fi 28 | -------------------------------------------------------------------------------- /files/auto/resume.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /start-utils 4 | if isTrue "${DEBUG_AUTOPAUSE}"; then 5 | set -x 6 | fi 7 | 8 | if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then 9 | pkill -CONT java 10 | 11 | # remove .paused file from data directory 12 | rm -f /data/.paused 13 | fi 14 | -------------------------------------------------------------------------------- /files/auto/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /start-utils 4 | if isTrue "${DEBUG_AUTOSTOP}"; then 5 | set -x 6 | fi 7 | 8 | logAutostopAction "Stopping Java process" 9 | pkill -f --signal SIGTERM mc-server-runner 10 | 11 | -------------------------------------------------------------------------------- /files/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /files/server.properties: -------------------------------------------------------------------------------- 1 | op-permission-level=4 2 | allow-nether=true 3 | level-name=world 4 | enable-query=false 5 | allow-flight=false 6 | announce-player-achievements=true 7 | server-port=25565 8 | rcon.port=25575 9 | query.port=25565 10 | level-type=DEFAULT 11 | enable-rcon=false 12 | force-gamemode=false 13 | level-seed= 14 | server-ip= 15 | max-tick-time=60000 16 | max-build-height=256 17 | spawn-npcs=true 18 | white-list=false 19 | spawn-animals=true 20 | hardcore=false 21 | snooper-enabled=true 22 | texture-pack= 23 | online-mode=true 24 | resource-pack= 25 | resource-pack-sha1= 26 | pvp=true 27 | difficulty=1 28 | enable-command-block=true 29 | player-idle-timeout=0 30 | gamemode=0 31 | max-players=20 32 | spawn-monsters=true 33 | generate-structures=true 34 | view-distance=10 35 | spawn-protection=16 36 | motd=A Minecraft Server powered by Docker 37 | generator-settings= 38 | rcon.password= 39 | max-world-size=29999984 40 | broadcast-console-to-ops=true 41 | broadcast-rcon-to-ops=true 42 | enable-jmx-monitoring=false 43 | sync-chunk-writes=true 44 | enable-status=true 45 | entity-broadcast-range-percentage=100 46 | function-permission-level=2 47 | network-compression-threshold=256 48 | op-permission-level=4 49 | prevent-proxy-connections=false 50 | use-native-transport=true 51 | enforce-whitelist=false 52 | -------------------------------------------------------------------------------- /kustomize/README.md: -------------------------------------------------------------------------------- 1 | This directory provides a base to use with [kubectl kustomize](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/). 2 | 3 | ## Example overlay content 4 | 5 | ### kustomization.yml 6 | ```yaml 7 | nameSuffix: "-forge" 8 | commonLabels: 9 | server: forge 10 | bases: 11 | - https://github.com/itzg/docker-minecraft-server.git/kustomize/base 12 | configMapGenerator: 13 | - name: mc 14 | envs: 15 | - mc.env 16 | patches: 17 | # Example of using a patch to set external service name for mc-router to pick up 18 | - path: set-external-servername.yml 19 | ``` 20 | 21 | ### mc.env 22 | ``` 23 | EULA=true 24 | TYPE=FORGE 25 | ``` 26 | 27 | ### 28 | 29 | ```yaml 30 | apiVersion: v1 31 | kind: Service 32 | metadata: 33 | name: mc 34 | annotations: 35 | mc-router.itzg.me/externalServerName: forge.example.com 36 | ``` -------------------------------------------------------------------------------- /kustomize/base/kustomization.yml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - statefulset.yml 5 | - service.yml -------------------------------------------------------------------------------- /kustomize/base/service.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | service: mc 6 | annotations: {} 7 | # Such as 8 | # mc-router.itzg.me/externalServerName: $(EXTERNAL_SERVICE_NAME) 9 | name: mc 10 | spec: 11 | ports: 12 | - name: minecraft 13 | port: 25565 14 | targetPort: 25565 15 | type: NodePort 16 | selector: 17 | server: mc -------------------------------------------------------------------------------- /kustomize/base/statefulset.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: mc 5 | spec: 6 | replicas: 1 7 | serviceName: mc 8 | selector: 9 | matchLabels: 10 | server: mc 11 | template: 12 | metadata: 13 | labels: 14 | server: mc 15 | spec: 16 | containers: 17 | - name: mc 18 | envFrom: 19 | - configMapRef: 20 | name: mc 21 | optional: true 22 | env: [] 23 | image: itzg/minecraft-server 24 | stdin: true 25 | tty: true 26 | volumeMounts: 27 | - mountPath: /data 28 | name: data 29 | resources: 30 | requests: 31 | cpu: 150m 32 | livenessProbe: 33 | exec: 34 | command: ["mc-health"] 35 | initialDelaySeconds: 120 36 | periodSeconds: 60 37 | readinessProbe: 38 | exec: 39 | command: ["mc-health"] 40 | initialDelaySeconds: 20 41 | periodSeconds: 10 42 | failureThreshold: 12 43 | volumeClaimTemplates: 44 | - metadata: 45 | name: data 46 | spec: 47 | accessModes: 48 | - ReadWriteOnce 49 | resources: 50 | requests: 51 | storage: 500Mi -------------------------------------------------------------------------------- /notes/.gitignore: -------------------------------------------------------------------------------- 1 | /*.bkp -------------------------------------------------------------------------------- /notes/Going from docker run to compose.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/notes/Going from docker run to compose.drawio.png -------------------------------------------------------------------------------- /notes/Hairpin routing.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/notes/Hairpin routing.drawio.png -------------------------------------------------------------------------------- /notes/Minecraft server containment.xml: -------------------------------------------------------------------------------- 1 | 1VVNc5swEP01HDMDUiDOMbGd5pK2Ux96VkGAxgJRIRvcX9+VWD40ODOZ1j0Uz9jS2w+t3ts1Ad1W/SfNmvJNZVwGJMz6gO4CQjZRCN8WuAxA8vgwAIUW2QBFM3AQvziCGFecRMZbz9EoJY1ofDBVdc1T42FMa9X5brmS/qkNK/gKOKRMrtHvIjMlolEYzoZXLooSj97EaPjB0mOh1anG8wJCc/cM5oqNudC/LVmmugVE9wHdaqXMsKr6LZeW2pG2Ie7lHetUt+a1+UgAGQLOTJ74WHEiIfQ5E2dbn7kgJ8nPky3q2fDe3DEpijqgT+AheW5mK6wK/HVZ2obVI7ZT6ZFrCHlVrRkdoLSlzwJ2BYwo8WohXSkMPzQstfsOWhCcSlNJ2EX21JFVu8mFlFsllXahdJ/YD+Bnro0AyZ+Gu+yMslnwZjt3LVd/KurCpgptLlWbA5aBXNs0vH+X/mgSFWaFq4obfQEXDKDYBhd/2809RzeIlYt2mxwZ9nkxZZ61hgXKfV16upK+EjBMmuXmruX67KSCATMMYL2SwDU5z5DkvxAE52NNvdHqyBeOoXs8UWIbplP8A3ES3UCVja/K41oVEl5RJYpuoMr9SpU34B+Qr0rD0ITD0JE4TuI/nopwLcKLexYi6OFet6CT3Pt8TjwtCI3IFUJv0eXxis9v2y+fr/D58P/yGf87PmE7v4ycbfHCp/vf -------------------------------------------------------------------------------- /notes/Understanding class file version errors.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/notes/Understanding class file version errors.drawio.png -------------------------------------------------------------------------------- /notes/container-network-namespaces.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/notes/container-network-namespaces.drawio.png -------------------------------------------------------------------------------- /notes/rbac-processing.mmd: -------------------------------------------------------------------------------- 1 | [Scia Reto](https://sciareto.org) mind map 2 | > __version__=`1.1`,showJumps=`true` 3 | --- 4 | 5 | # RBAC processing 6 | 7 | ## inputs 8 | 9 | ### whitelist 10 | 11 | #### command or space limited 12 | 13 | ##### uuid 14 | 15 | ##### username 16 | 17 | ### ops 18 | 19 | #### username 20 | 21 | #### uuid 22 | 23 | ### whitelist file 24 | 25 | #### url? 26 | 27 | ##### yes 28 | 29 | ###### download 30 | 31 | ##### no 32 | 33 | ###### copy 34 | 35 | ### override whitelist? 36 | 37 | #### yes 38 | 39 | ##### replace all with given input list 40 | 41 | #### no 42 | 43 | ##### append only 44 | 45 | ## format 46 | 47 | ### version \< 1\.7\.6? 48 | 49 | #### yes 50 | 51 | ##### text file listing usernames 52 | 53 | ###### white\-list\.txt 54 | 55 | ###### ops\.txt 56 | 57 | #### no 58 | > leftSide=`true` 59 | 60 | 61 | ##### json file 62 | 63 | ###### array of objects 64 | 65 | ####### name 66 | 67 | ######## can be any string, even an empty one 68 | 69 | ####### uuid 70 | > leftSide=`true` 71 | 72 | 73 | ######## username to UUID API 74 | - LINK 75 |
https://wiki.vg/Mojang_API#Username_to_UUID
76 | 77 | ######## needs to be "dashed" UUID syntax 78 | > leftSide=`true` 79 | 80 | 81 | ####### ops? 82 | 83 | ######## yes 84 | 85 | ######### also includes 86 | 87 | ########## level 88 | 89 | ########### integer, usually a 4 90 | 91 | ########## bypassesPlayerLimit 92 | 93 | ########### boolean 94 | -------------------------------------------------------------------------------- /notes/start-script-flow.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/notes/start-script-flow.drawio.png -------------------------------------------------------------------------------- /scripts/start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | 6 | # The Dockerfile ENVs take precedence here, but defaulting for testing consistency 7 | : "${UID:=1000}" 8 | : "${GID:=1000}" 9 | : "${SKIP_CHOWN_DATA:=false}" 10 | 11 | umask "${UMASK:=0002}" 12 | 13 | # Remove from previous run and do this as elevated user since file used to be created before demoting 14 | rm -f "$HOME/.rcon-cli.env" 15 | 16 | if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then 17 | runAsUser=minecraft 18 | runAsGroup=minecraft 19 | 20 | if [[ -v UID ]]; then 21 | if [[ $UID != 0 ]]; then 22 | if [[ $UID != $(id -u minecraft) ]]; then 23 | log "Changing uid of minecraft to $UID" 24 | usermod -u $UID minecraft 25 | fi 26 | else 27 | runAsUser=root 28 | fi 29 | fi 30 | 31 | if [[ -v GID ]]; then 32 | if [[ $GID != 0 ]]; then 33 | if [[ $GID != $(id -g minecraft) ]]; then 34 | log "Changing gid of minecraft to $GID" 35 | groupmod -o -g "$GID" minecraft 36 | fi 37 | else 38 | runAsGroup=root 39 | fi 40 | fi 41 | 42 | if isFalse "${SKIP_CHOWN_DATA}" && [[ $(stat -c "%u" /data) != "$UID" ]]; then 43 | log "Changing ownership of /data to $UID ..." 44 | chown -R ${runAsUser}:${runAsGroup} /data 45 | fi 46 | 47 | if [[ ${SKIP_NSSWITCH_CONF^^} != TRUE ]]; then 48 | echo 'hosts: files dns' > /etc/nsswitch.conf 49 | fi 50 | 51 | exec $(getSudoFromDistro) ${runAsUser}:${runAsGroup} "${SCRIPTS:-/}start-configuration" "$@" 52 | else 53 | exec "${SCRIPTS:-/}start-configuration" "$@" 54 | fi 55 | -------------------------------------------------------------------------------- /scripts/start-autostop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | 6 | : "${SERVER_PORT:=25565}" 7 | : "${ENABLE_AUTOSTOP:=false}" 8 | : "${AUTOSTOP_TIMEOUT_EST:=3600}" 9 | : "${AUTOSTOP_TIMEOUT_INIT:=1800}" 10 | : "${AUTOSTOP_PERIOD:=10}" 11 | : "${DEBUG_AUTOSTOP:=false}" 12 | export SERVER_PORT 13 | export ENABLE_AUTOSTOP 14 | export AUTOSTOP_TIMEOUT_EST 15 | export AUTOSTOP_TIMEOUT_INIT 16 | export AUTOSTOP_PERIOD 17 | export DEBUG_AUTOSTOP 18 | 19 | log "Autostop functionality enabled" 20 | 21 | isDebugging && set -x 22 | 23 | isNumericElseSetToDefault "AUTOSTOP_PERIOD" 10 24 | checkIfNotZeroElseSetToDefault "AUTOSTOP_PERIOD" 10 25 | isNumericElseSetToDefault "AUTOSTOP_TIMEOUT_EST" 3600 26 | isNumericElseSetToDefault "AUTOSTOP_TIMEOUT_INIT" 1800 27 | 28 | /auto/autostop-daemon.sh & 29 | -------------------------------------------------------------------------------- /scripts/start-deployArcLight: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-$(dirname "$0")}/start-utils" 5 | set -o pipefail 6 | set -e 7 | isDebugging && set -x 8 | 9 | resolveVersion 10 | : "${ARCLIGHT_RELEASE:=latest}" 11 | : "${ARCLIGHT_TYPE:=neoforge}" 12 | 13 | arclightReleasesUrl=https://api.github.com/repos/IzzelAliz/Arclight/releases 14 | if [[ ${ARCLIGHT_RELEASE^^} = LATEST ]]; then 15 | arclightReleaseUrl=${arclightReleasesUrl}/latest 16 | else 17 | arclightReleaseUrl=${arclightReleasesUrl}/tags/${ARCLIGHT_RELEASE} 18 | fi 19 | 20 | if ! downloadUrl=$(get --json-path "$.assets[?(@.name =~ /arclight-${ARCLIGHT_TYPE,,}-${VERSION}-.*\.jar/)].browser_download_url" \ 21 | --accept "application/vnd.github.v3+json" "$arclightReleaseUrl"); then 22 | logError "Failed to access ${ARCLIGHT_RELEASE} release of Arclight" 23 | exit 1 24 | fi 25 | 26 | if [[ $downloadUrl = null ]]; then 27 | logError "Failed to locate Arclight jar for $VERSION from ${ARCLIGHT_RELEASE}" 28 | exit 1 29 | fi 30 | 31 | log "Downloading Arclight from $downloadUrl" 32 | if ! SERVER=$(get --skip-existing --output-filename -o /data "$downloadUrl"); then 33 | logError "Arclight jar from $downloadUrl" 34 | exit 1 35 | fi 36 | 37 | export SERVER 38 | export FAMILY=HYBRID 39 | export HYBRIDTYPE="${ARCLIGHT_TYPE,,}" 40 | 41 | exec "${SCRIPTS:-/}start-spiget" "$@" 42 | -------------------------------------------------------------------------------- /scripts/start-deployCatserver: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | set -o pipefail 6 | set -e 7 | 8 | latestAsset=$( 9 | curl -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/latest | \ 10 | jq '.assets[] | select(.name | match(".*-universal.jar"))' 11 | ) 12 | 13 | if [[ -z "${latestAsset}" ]]; then 14 | logError "Latest release of Catserver is missing universal.jar asset" 15 | exit 1 16 | fi 17 | 18 | isDebugging && log "Latest asset ${latestAsset}" 19 | latestJarName=$(echo ${latestAsset} | jq --raw-output '.name') 20 | latestJarId=$(echo ${latestAsset} | jq --raw-output '.id') 21 | 22 | 23 | export SERVER="/data/${latestJarName}" 24 | 25 | if [ ! -f ${SERVER} ]; then 26 | log "Downloading ${latestJarName}" 27 | curl -H "Accept:application/octet-stream" -o "$SERVER" -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/assets/${latestJarId} 28 | fi 29 | 30 | export FAMILY=HYBRID 31 | export HYBRIDTYPE=forge 32 | 33 | exec "${SCRIPTS:-/}start-spiget" "$@" 34 | -------------------------------------------------------------------------------- /scripts/start-deployCrucible: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-$(dirname "$0")}/start-utils" 5 | set -o pipefail 6 | set -e 7 | isDebugging && set -x 8 | 9 | resolveVersion 10 | : "${CRUCIBLE_RELEASE:=latest}" 11 | 12 | crucibleReleasesUrl=https://api.github.com/repos/CrucibleMC/Crucible/releases 13 | if [[ ${CRUCIBLE_RELEASE^^} = LATEST ]]; then 14 | crucibleReleaseUrl=${crucibleReleasesUrl}/latest 15 | else 16 | crucibleReleaseUrl=${crucibleReleasesUrl}/tags/${CRUCIBLE_RELEASE} 17 | fi 18 | 19 | if ! downloadUrl=$(get --json-path "$.assets[?(@.name =~ /Crucible-${VERSION}-.*\.jar/)].browser_download_url" \ 20 | --accept "application/vnd.github.v3+json" "$crucibleReleaseUrl"); then 21 | logError "Failed to access ${CRUCIBLE_RELEASE} release of Crucible" 22 | exit 1 23 | fi 24 | 25 | if [[ $downloadUrl = null ]]; then 26 | logError "Failed to locate Crucible jar for $VERSION from ${CRUCIBLE_RELEASE}" 27 | exit 1 28 | fi 29 | 30 | log "Downloading Crucible from $downloadUrl" 31 | if ! SERVER=$(get --skip-existing --output-filename -o /data "$downloadUrl"); then 32 | logError "Crucible jar from $downloadUrl" 33 | exit 1 34 | fi 35 | 36 | librariesDir=/data/libraries 37 | if [ ! -d "$librariesDir" ]; then 38 | if ! librariesUrl=$(get --json-path "$.assets[?(@.name == 'libraries.zip')].browser_download_url" \ 39 | --accept "application/vnd.github.v3+json" "$crucibleReleaseUrl"); then 40 | logError "Failed to access ${CRUCIBLE_RELEASE} release of Crucible for libraries" 41 | exit 1 42 | fi 43 | 44 | log "Downloading Crucible libraries" 45 | if ! get -o /tmp/libraries.zip "$librariesUrl"; then 46 | logError "Failed to download Crucible libraries from $librariesUrl" 47 | exit 1 48 | fi 49 | 50 | if ! unzip /tmp/libraries.zip -d "$librariesDir"; then 51 | logError "Failed to unzip Crucible libraries" 52 | exit 1 53 | fi 54 | rm /tmp/libraries.zip 55 | fi 56 | 57 | export SERVER 58 | export FAMILY=HYBRID 59 | export HYBRIDTYPE=forge 60 | 61 | exec "${SCRIPTS:-/}start-spiget" "$@" 62 | -------------------------------------------------------------------------------- /scripts/start-deployCustom: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | : "${CUSTOM_SERVER:=}" 4 | : "${GENERIC_PACK:=}" 5 | : "${CUSTOM_JAR_EXEC:=}" 6 | 7 | # shellcheck source=start-utils 8 | . "${SCRIPTS:-/}start-utils" 9 | isDebugging && set -x 10 | 11 | if isURL "${CUSTOM_SERVER}"; then 12 | filename=$(basename "${CUSTOM_SERVER}") 13 | export SERVER=/data/${filename} 14 | 15 | if [[ -f ${SERVER} ]] && ! isTrue "$FORCE_REDOWNLOAD"; then 16 | log "Using previously downloaded jar at ${SERVER}" 17 | else 18 | log "Downloading custom server jar from ${CUSTOM_SERVER} ..." 19 | if ! curl -sSL -o "${SERVER}" "${CUSTOM_SERVER}"; then 20 | log "Failed to download from ${CUSTOM_SERVER}" 21 | exit 2 22 | fi 23 | fi 24 | 25 | elif [[ -f ${CUSTOM_SERVER} ]]; then 26 | export SERVER=${CUSTOM_SERVER} 27 | 28 | elif [[ ${GENERIC_PACK} ]]; then 29 | log "Using custom server jar from generic pack at ${CUSTOM_SERVER} ..." 30 | export SERVER=${CUSTOM_SERVER} 31 | 32 | elif [[ ${CUSTOM_JAR_EXEC} ]]; then 33 | log "CUSTOM_JAR_EXEC is in use, so \$SERVER will not be set" 34 | 35 | else 36 | log "CUSTOM_SERVER is not properly set to a URL or existing jar file" 37 | exit 2 38 | 39 | fi 40 | 41 | # Allow for overriding Family on custom for testing. 42 | export FAMILY="${FAMILY:-HYBRID}" 43 | export HYBRIDTYPE="${HYBRIDTYPE:-any}" 44 | 45 | exec "${SCRIPTS:-/}start-spiget" "$@" 46 | -------------------------------------------------------------------------------- /scripts/start-deployFabric: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # shellcheck source=start-utils 5 | . "${SCRIPTS:-/}start-utils" 6 | 7 | export TYPE=FABRIC 8 | : "${FABRIC_LAUNCHER_VERSION:=${FABRIC_INSTALLER_VERSION:-LATEST}}" 9 | : "${FABRIC_LAUNCHER:=}" 10 | : "${FABRIC_LAUNCHER_URL:=}" 11 | : "${FABRIC_LOADER_VERSION:=LATEST}" 12 | 13 | resultsFile=/data/.install-fabric.env 14 | 15 | isDebugging && set -x 16 | 17 | # Custom fabric jar 18 | if [[ $FABRIC_LAUNCHER ]]; then 19 | if ! mc-image-helper install-fabric-loader \ 20 | --results-file=${resultsFile} \ 21 | --from-local-file="$FABRIC_LAUNCHER"; then 22 | logError "Failed to use provided Fabric launcher" 23 | exit 1 24 | fi 25 | 26 | # Custom fabric jar url 27 | elif [[ $FABRIC_LAUNCHER_URL ]]; then 28 | if ! mc-image-helper install-fabric-loader \ 29 | --results-file=${resultsFile} \ 30 | --from-url="$FABRIC_LAUNCHER_URL"; then 31 | logError "Failed to installFabric launcher from $FABRIC_LAUNCHER_URL" 32 | exit 1 33 | fi 34 | 35 | # Official fabric launcher 36 | else 37 | if ! mc-image-helper install-fabric-loader \ 38 | --results-file=${resultsFile} \ 39 | --minecraft-version="${VERSION}" \ 40 | --installer-version="${FABRIC_LAUNCHER_VERSION}" \ 41 | --loader-version="${FABRIC_LOADER_VERSION}"; then 42 | logError "Failed to installFabric launcher given $VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION" 43 | exit 1 44 | fi 45 | fi 46 | 47 | applyResultsFile ${resultsFile} 48 | 49 | export FAMILY=FABRIC 50 | exec "${SCRIPTS:-/}start-setupWorld" "$@" 51 | -------------------------------------------------------------------------------- /scripts/start-deployFolia: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | : "${FOLIA_CHANNEL:=experimental}" 4 | 5 | # shellcheck source=start-utils 6 | . "${SCRIPTS:-/}start-utils" 7 | set -o pipefail 8 | handleDebugMode 9 | 10 | if [[ $FOLIA_DOWNLOAD_URL ]]; then 11 | export PAPER_DOWNLOAD_URL="$FOLIA_DOWNLOAD_URL" 12 | fi 13 | 14 | if [[ $FOLIABUILD ]]; then 15 | export PAPERBUILD="$FOLIABUILD" 16 | fi 17 | 18 | PAPER_PROJECT="folia" \ 19 | PAPER_NAME="FoliaMC" \ 20 | PAPER_CHANNEL="${FOLIA_CHANNEL}" \ 21 | exec "${SCRIPTS:-/}start-deployPaper" "$@" 22 | -------------------------------------------------------------------------------- /scripts/start-deployForge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | : "${FORGE_VERSION:=${FORGEVERSION:-RECOMMENDED}}" 4 | : "${FORGE_FORCE_REINSTALL:=false}}" 5 | 6 | # shellcheck source=start-utils 7 | . "${SCRIPTS:-$(dirname "$0")}/start-utils" 8 | isDebugging && set -x 9 | resultsFile=/data/.run-forge.env 10 | 11 | function mc-image-helper-forge() { 12 | mc-image-helper install-forge \ 13 | --output-directory=/data \ 14 | --results-file="${resultsFile}" \ 15 | --minecraft-version="${VERSION}" \ 16 | --force-reinstall="${FORGE_FORCE_REINSTALL}" "$@" 17 | } 18 | 19 | if [[ ${FORGE_INSTALLER} ]]; then 20 | if ! mc-image-helper-forge --forge-installer="${FORGE_INSTALLER}" ; then 21 | logError "Failed to installForge given installer ${FORGE_INSTALLER}" 22 | exit 1 23 | fi 24 | elif [[ ${FORGE_INSTALLER_URL:-} ]]; then 25 | mkdir -p tmp 26 | if ! installer=$(get -o tmp --output-filename "${FORGE_INSTALLER_URL}"); then 27 | logError "Failed to download installer from $FORGE_INSTALLER_URL" 28 | exit 1 29 | fi 30 | 31 | # shellcheck disable=SC2064 32 | trap "rm $installer" EXIT 33 | 34 | if ! mc-image-helper-forge --forge-installer="${installer}" ; then 35 | logError "Failed to install forge from ${FORGE_INSTALLER_URL}" 36 | exit 1 37 | fi 38 | else 39 | if ! mc-image-helper-forge --forge-version="${FORGE_VERSION}"; then 40 | logError "Failed to install Forge" 41 | exit 1 42 | fi 43 | fi 44 | 45 | applyResultsFile ${resultsFile} 46 | 47 | export FAMILY=FORGE 48 | 49 | exec "${SCRIPTS:-/}start-setupWorld" "$@" 50 | -------------------------------------------------------------------------------- /scripts/start-deployKetting: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | isDebugging && set -x 6 | 7 | if ! SERVER=$(mc-image-helper github download-latest-asset \ 8 | --output-directory=/data \ 9 | --name-pattern="kettinglauncher-.+?(? 1.18.1, 50 => 1.18.2 etc" 13 | exit 1 14 | fi 15 | 16 | : "${PUFFERFISH_BUILD:=lastSuccessfulBuild}" 17 | 18 | majorVersion=$(get_major_version "$VERSION") 19 | PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${majorVersion}/${PUFFERFISH_BUILD}/api/json") 20 | # Example: "url": "https://ci.pufferfish.host/job/Pufferfish-1.18/50/", 21 | PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' ) 22 | # Example: "fileName": "pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar", 23 | PUFFERFISH_BUILD_FILENAME=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.artifacts[].fileName // empty' ) 24 | PUFFERFISH_BUILD_DOWNLOAD_URL="${PUFFERFISH_BUILD_URL}artifact/build/libs/${PUFFERFISH_BUILD_FILENAME}" 25 | 26 | # Setting server to the Jar filename for export. 27 | export SERVER=$PUFFERFISH_BUILD_FILENAME 28 | 29 | log "Removing old Pufferfish versions ..." 30 | shopt -s nullglob 31 | for f in pufferfish-*.jar; do 32 | [[ $f != "$SERVER" ]] && rm "$f" 33 | done 34 | 35 | if [[ ! -f "$SERVER" ]] || isTrue "${FORCE_REDOWNLOAD:-false}"; then 36 | log "Downloading Pufferfish from $PUFFERFISH_BUILD_DOWNLOAD_URL ..." 37 | if ! get -o "$SERVER" "$PUFFERFISH_BUILD_DOWNLOAD_URL"; then 38 | logError "Failed to download from $PUFFERFISH_BUILD_DOWNLOAD_URL (status=$?)" 39 | exit 3 40 | fi 41 | fi 42 | 43 | # Normalize on Spigot for later operations 44 | export FAMILY=SPIGOT 45 | 46 | exec "${SCRIPTS:-/}start-spiget" "$@" 47 | -------------------------------------------------------------------------------- /scripts/start-deployPurpur: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | : "${PURPUR_BUILD:=LATEST}" 6 | : "${PURPUR_DOWNLOAD_URL:=}" 7 | 8 | # shellcheck source=start-utils 9 | . "${SCRIPTS:-/}start-utils" 10 | isDebugging && set -x 11 | 12 | resultsFile=/data/.purpur.env 13 | 14 | if [[ $PURPUR_DOWNLOAD_URL ]]; then 15 | if ! mc-image-helper install-purpur \ 16 | --output-directory=/data \ 17 | --results-file="$resultsFile" \ 18 | --url="${PURPUR_DOWNLOAD_URL}"; then 19 | logError "Failed to download from custom Purpur URL" 20 | exit 1 21 | fi 22 | else 23 | args=( 24 | --output-directory=/data 25 | --results-file="$resultsFile" 26 | --version="$VERSION" 27 | ) 28 | if [[ $PURPUR_BUILD ]]; then 29 | args+=(--build="$PURPUR_BUILD") 30 | fi 31 | if ! mc-image-helper install-purpur "${args[@]}"; then 32 | logError "Failed to download Purpur" 33 | exit 1 34 | fi 35 | fi 36 | 37 | applyResultsFile ${resultsFile} 38 | 39 | # Normalize on Spigot for later operations 40 | export FAMILY=SPIGOT 41 | 42 | exec "${SCRIPTS:-/}start-spiget" "$@" 43 | -------------------------------------------------------------------------------- /scripts/start-deployQuilt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # shellcheck source=start-utils 5 | . "${SCRIPTS:-/}start-utils" 6 | 7 | : "${QUILT_LAUNCHER:=}" 8 | : "${QUILT_LAUNCHER_URL:=}" 9 | : "${QUILT_INSTALLER_URL:=}" 10 | : "${QUILT_INSTALLER_VERSION:=LATEST}" 11 | : "${QUILT_LOADER_VERSION:=LATEST}" 12 | 13 | isDebugging && set -x 14 | 15 | function mc-image-helper-quilt(){ 16 | mc-image-helper install-quilt \ 17 | --loader-version="$QUILT_LOADER_VERSION" \ 18 | --minecraft-version="$VERSION" \ 19 | --output-directory=/data \ 20 | --results-file="$resultsFile" "$@" 21 | } 22 | 23 | resultsFile=/data/.quilt.env 24 | 25 | if [[ $QUILT_LAUNCHER ]]; then 26 | logWarning "Use of QUILT_LAUNCHER is a deprecated feature." 27 | SERVER="$QUILT_LAUNCHER" 28 | export SERVER 29 | resolveVersion 30 | 31 | export FAMILY=FABRIC 32 | exec "${SCRIPTS:-/}start-setupWorld" "$@" 33 | 34 | elif [[ $QUILT_LAUNCHER_URL ]]; then 35 | logError "QUILT_LAUNCHER_URL is not longer supported. Pre-download and use QUILT_LAUNCHER." 36 | exit 2 37 | 38 | elif [[ $QUILT_INSTALLER_URL ]]; then 39 | if ! mc-image-helper-quilt --installer-url="$QUILT_INSTALLER_URL"; then 40 | logError "Failed to installQuilt given custom installer URL $QUILT_INSTALLER_URL" 41 | exit 2 42 | fi 43 | 44 | else 45 | if ! mc-image-helper-quilt --installer-version="$QUILT_INSTALLER_VERSION"; then 46 | logError "Failed to installQuilt given installer version $QUILT_INSTALLER_VERSION" 47 | exit 2 48 | fi 49 | 50 | fi 51 | 52 | applyResultsFile ${resultsFile} 53 | 54 | export FAMILY=FABRIC 55 | exec "${SCRIPTS:-/}start-setupWorld" "$@" 56 | -------------------------------------------------------------------------------- /scripts/start-deploySpongeVanilla: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . ${SCRIPTS:-/}start-utils 5 | 6 | export TYPE=spongevanilla 7 | : ${SPONGEBRANCH:=STABLE} 8 | : ${SPONGEVERSION:=} 9 | 10 | # Parse branch 11 | log "Choosing branch for Sponge" 12 | case "$SPONGEBRANCH" in 13 | 14 | EXPERIMENTAL|experimental|BLEEDING|bleeding) 15 | SPONGEBRANCH=bleeding 16 | ;; 17 | 18 | *) 19 | SPONGEBRANCH=stable 20 | ;; 21 | 22 | esac 23 | 24 | # If not SPONGEVERSION selected, detect last version on selected branch 25 | if [ -z $SPONGEVERSION ]; then 26 | log "Choosing Version for Sponge" 27 | SPONGEVERSION=$(curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r --arg SPONGEBRANCH "$SPONGEBRANCH" '.buildTypes.$SPONGEBRANCH.latest.version') 28 | fi 29 | 30 | VERSION="$SPONGEVERSION" 31 | export VERSION 32 | export SERVER="spongevanilla-$SPONGEVERSION.jar" 33 | 34 | if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then 35 | log "Downloading $SERVER ..." 36 | curl -sSL -o "$SERVER" "https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER" 37 | fi 38 | 39 | export FAMILY=SPONGE 40 | exec "${SCRIPTS:-/}start-setupWorld" "$@" 41 | -------------------------------------------------------------------------------- /scripts/start-deployVanilla: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | isDebugging && set -x 6 | set -o pipefail 7 | 8 | resolveVersion 9 | export SERVER="minecraft_server.${VERSION// /_}.jar" 10 | 11 | if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then 12 | debug "Finding version manifest for $VERSION" 13 | versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VERSION "$VERSION" --raw-output '[.versions[]|select(.id == $VERSION)][0].url') 14 | result=$? 15 | if [ $result != 0 ]; then 16 | logError "Failed to obtain version manifest URL ($result)" 17 | exit 1 18 | fi 19 | if [ "$versionManifestUrl" = "null" ]; then 20 | logError "Couldn't find a matching manifest entry for $VERSION" 21 | exit 1 22 | fi 23 | debug "Found version manifest at $versionManifestUrl" 24 | 25 | if ! serverDownloadUrl=$(get --json-path '$.downloads.server.url' "${versionManifestUrl}"); then 26 | logError "Failed to obtain version manifest from $versionManifestUrl ($result)" 27 | exit 1 28 | elif [ "$serverDownloadUrl" = "null" ]; then 29 | logError "There is not a server download for version $VERSION" 30 | exit 1 31 | fi 32 | 33 | log "Downloading $VERSION server..." 34 | debug "Downloading server from $serverDownloadUrl" 35 | get -o "$SERVER" "$serverDownloadUrl" 36 | result=$? 37 | if [ $result != 0 ]; then 38 | logError "Failed to download server from $serverDownloadUrl ($result)" 39 | exit 1 40 | fi 41 | fi 42 | minecraftServerJarPath=/data/minecraft_server.jar 43 | 44 | if versionLessThan 1.6; then 45 | if ! [[ -L $minecraftServerJarPath && $minecraftServerJarPath -ef "/data/$SERVER" ]]; then 46 | rm -f $minecraftServerJarPath 47 | ln -s "/data/$SERVER" $minecraftServerJarPath 48 | fi 49 | SERVER=minecraft_server.jar 50 | elif [[ -L $minecraftServerJarPath ]]; then 51 | rm -f $minecraftServerJarPath 52 | fi 53 | 54 | isDebugging && ls -l 55 | export FAMILY=VANILLA 56 | exec "${SCRIPTS:-/}start-setupWorld" "$@" 57 | -------------------------------------------------------------------------------- /scripts/start-rconcmds: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | 6 | : "${RCON_CMDS_STARTUP:=}" 7 | : "${RCON_CMDS_ON_CONNECT:=}" 8 | : "${RCON_CMDS_ON_DISCONNECT:=}" 9 | : "${RCON_CMDS_FIRST_CONNECT:=}" 10 | : "${RCON_CMDS_LAST_DISCONNECT:=}" 11 | : "${RCON_CMDS_PERIOD:=10}" 12 | : "${SERVER_PORT:=25565}" 13 | export RCON_CMDS_STARTUP 14 | export RCON_CMDS_ON_CONNECT 15 | export RCON_CMDS_ON_DISCONNECT 16 | export RCON_CMDS_FIRST_CONNECT 17 | export RCON_CMDS_LAST_DISCONNECT 18 | export RCON_CMDS_PERIOD 19 | export SERVER_PORT 20 | 21 | log "Rcon cmds functionality enabled" 22 | 23 | isDebugging && set -x 24 | 25 | isNumericElseSetToDefault RCON_CMDS_PERIOD 10 26 | checkIfNotZeroElseSetToDefault RCON_CMDS_PERIOD 10 27 | 28 | /usr/local/bin/rcon-cmds-daemon.sh & 29 | -------------------------------------------------------------------------------- /scripts/start-setupEnvVariables: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | 6 | set -e 7 | handleDebugMode 8 | 9 | : "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}" 10 | : "${REPLACE_ENV_PATHS:=/data}" 11 | : "${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}" 12 | : "${REPLACE_ENV_VARIABLE_PREFIX=${ENV_VARIABLE_PREFIX:-CFG_}}" 13 | : "${REPLACE_ENV_VARIABLES_EXCLUDES:=}" 14 | : "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}" 15 | : "${PATCH_DEFINITIONS:=}" 16 | : "${DEBUG:=false}" 17 | : "${DOWNLOAD_DEFAULT_CONFIGS:=}" 18 | 19 | if isTrue "${REPLACE_ENV_IN_PLACE}"; then 20 | log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..." 21 | 22 | mc-image-helper interpolate \ 23 | --replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \ 24 | --replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \ 25 | --replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \ 26 | --replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \ 27 | "${REPLACE_ENV_PATHS[@]}" 28 | fi 29 | 30 | if [[ $DOWNLOAD_DEFAULT_CONFIGS ]]; then 31 | log "Downloading default configs, if needed" 32 | if ! mc-image-helper mcopy \ 33 | --to /data/config \ 34 | --skip-existing --skip-up-to-date=false \ 35 | "$DOWNLOAD_DEFAULT_CONFIGS" 2> /dev/null; then 36 | logWarning "One or more default config files were not available from $DOWNLOAD_DEFAULT_CONFIGS" 37 | fi 38 | fi 39 | if [[ $DOWNLOAD_DEFAULTS ]]; then 40 | log "Downloading default top-level configs, if needed" 41 | if ! mc-image-helper mcopy \ 42 | --to /data \ 43 | --skip-existing --skip-up-to-date=false \ 44 | "$DOWNLOAD_DEFAULTS" 2> /dev/null; then 45 | logWarning "One or more default files were not available from $DOWNLOAD_DEFAULTS" 46 | fi 47 | fi 48 | 49 | if [[ ${PATCH_DEFINITIONS} ]]; then 50 | log "Applying patch definitions from ${PATCH_DEFINITIONS}" 51 | mc-image-helper patch \ 52 | --patch-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \ 53 | "${PATCH_DEFINITIONS}" 54 | fi 55 | 56 | exec "${SCRIPTS:-/}start-setupRbac" "$@" 57 | -------------------------------------------------------------------------------- /scripts/start-setupMounts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # shellcheck source=start-utils 4 | . "${SCRIPTS:-/}start-utils" 5 | 6 | : "${SYNC_SKIP_NEWER_IN_DESTINATION:=${PLUGINS_SYNC_UPDATE:-true}}" 7 | : "${REPLACE_ENV_DURING_SYNC:=true}" 8 | : "${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}" 9 | : "${REPLACE_ENV_VARIABLE_PREFIX=${ENV_VARIABLE_PREFIX:-CFG_}}" 10 | : "${REPLACE_ENV_VARIABLES_EXCLUDES:=}" 11 | : "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}" 12 | : "${DEBUG:=false}" 13 | : "${MODS_OUT_DIR:=/data/mods}" 14 | : "${PLUGINS_OUT_DIR:=/data/plugins}" 15 | 16 | set -e 17 | isDebugging && set -x 18 | 19 | if isTrue "${SYNC_SKIP_NEWER_IN_DESTINATION}"; then 20 | updateArg="--skip-newer-in-destination" 21 | fi 22 | 23 | if isTrue "${REPLACE_ENV_DURING_SYNC}"; then 24 | subcommand=sync-and-interpolate 25 | else 26 | subcommand=sync 27 | fi 28 | 29 | function mc-image-helper-mounts(){ 30 | mc-image-helper \ 31 | ${subcommand} $updateArg \ 32 | --replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \ 33 | --replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \ 34 | --replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \ 35 | --replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" "$@" 36 | } 37 | 38 | : "${COPY_PLUGINS_SRC:="/plugins"}" 39 | : "${COPY_PLUGINS_DEST:=${PLUGINS_OUT_DIR}}" 40 | 41 | if usesPlugins; then 42 | mkdir -p "${COPY_PLUGINS_DEST}" 43 | log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}" 44 | mc-image-helper-mounts "${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}" 45 | fi 46 | 47 | : "${COPY_MODS_SRC:="/mods"}" 48 | : "${COPY_MODS_DEST:=${MODS_OUT_DIR}}" 49 | 50 | if usesMods; then 51 | log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}" 52 | mc-image-helper-mounts "${COPY_MODS_SRC}" "${COPY_MODS_DEST}" 53 | fi 54 | 55 | : "${COPY_CONFIG_SRC:="/config"}" 56 | : "${COPY_CONFIG_DEST:="/data/config"}" 57 | 58 | log "Copying any configs from ${COPY_CONFIG_SRC} to ${COPY_CONFIG_DEST}" 59 | mc-image-helper-mounts "${COPY_CONFIG_SRC}" "${COPY_CONFIG_DEST}" 60 | 61 | exec "${SCRIPTS:-/}start-setupServerProperties" "$@" 62 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | data/ 2 | cf_api_key.secret -------------------------------------------------------------------------------- /tests/fulltests/multi-part-motd/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | monitor: 3 | depends_on: 4 | - mc 5 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 6 | entrypoint: mc-monitor 7 | command: status --host mc --retry-interval 1s --timeout 1s --retry-limit 60 8 | mc: 9 | restart: "no" 10 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 11 | environment: 12 | EULA: "TRUE" 13 | VERSION: ${MINECRAFT_VERSION:-LATEST} 14 | TYPE: PAPER 15 | # regression tests https://github.com/itzg/docker-minecraft-server/issues/2545 16 | MOTD: "Foo§rBar" 17 | 18 | -------------------------------------------------------------------------------- /tests/fulltests/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # go to script root directory 4 | cd "$(dirname "$0")" || exit 1 5 | 6 | down() { 7 | docker compose -f "$1" down -v --remove-orphans 8 | } 9 | 10 | # tests to completely spin up Minecraft and use the monitor to validate the service is running. 11 | fullMinecraftUpTest(){ 12 | file="$1" 13 | failed=false 14 | # run the monitor to validate the Minecraft image is healthy 15 | docker compose -f "$file" run monitor || failed=true 16 | echo "$(dirname "$file") Result: failed=$failed" 17 | if $failed; then 18 | docker compose logs mc 19 | down "$file" 20 | return 1 21 | else 22 | down "$file" 23 | fi 24 | } 25 | 26 | # go through each folder in fulltests and run fullbuilds 27 | files=$(ls */docker-compose.yml) 28 | for file in $files; do 29 | 30 | echo "Starting Tests on $(dirname "$file")" 31 | if ! fullMinecraftUpTest "$file"; then 32 | exit 2 33 | fi 34 | 35 | done 36 | -------------------------------------------------------------------------------- /tests/fulltests/vanilla-latest/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | monitor: 3 | depends_on: 4 | - mc 5 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 6 | entrypoint: mc-monitor 7 | command: status --host mc --retry-interval 1s --timeout 1s --retry-limit 300 8 | mc: 9 | restart: "no" 10 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 11 | environment: 12 | EULA: "TRUE" 13 | VERSION: ${MINECRAFT_VERSION:-LATEST} 14 | 15 | -------------------------------------------------------------------------------- /tests/setuponlytests/auto_curseforge/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "TRUE" 7 | MODPACK_PLATFORM: AUTO_CURSEFORGE 8 | CF_API_KEY: ${CF_API_KEY} 9 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/the-pixelmon-modpack/files/5954570 10 | DEBUG: true 11 | volumes: 12 | - ./data:/data 13 | 14 | -------------------------------------------------------------------------------- /tests/setuponlytests/auto_curseforge/require.sh: -------------------------------------------------------------------------------- 1 | [[ $CF_API_KEY ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/auto_curseforge/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/mods/ExplorersCompass-1.16.5-1.1.2-forge.jar" 2 | mc-image-helper assert fileExists "/data/forge-1.16.5-36.2.34.jar" 3 | -------------------------------------------------------------------------------- /tests/setuponlytests/auto_curseforge_file/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "TRUE" 7 | MODPACK_PLATFORM: AUTO_CURSEFORGE 8 | CF_API_KEY_FILE: /run/secrets/cf_api_key 9 | CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/the-pixelmon-modpack/files/5954570 10 | DEBUG: true 11 | volumes: 12 | - ./data:/data 13 | secrets: 14 | - cf_api_key 15 | secrets: 16 | cf_api_key: 17 | file: cf_api_key.secret 18 | 19 | -------------------------------------------------------------------------------- /tests/setuponlytests/auto_curseforge_file/require.sh: -------------------------------------------------------------------------------- 1 | [[ -n "$CF_API_KEY" ]] || exit 1 2 | echo "$CF_API_KEY" > cf_api_key.secret || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/auto_curseforge_file/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/mods/ExplorersCompass-1.16.5-1.1.2-forge.jar" 2 | mc-image-helper assert fileExists "/data/forge-1.16.5-36.2.34.jar" 3 | -------------------------------------------------------------------------------- /tests/setuponlytests/cf_files/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: FABRIC 9 | VERSION: 1.20.1 10 | # Contains mix of Forge and Fabric mods 11 | CURSEFORGE_FILES: | 12 | https://www.curseforge.com/minecraft/mc-mods/clumps/files/4153343 13 | jei 14 | 306612 15 | @/extras/listing.txt 16 | CF_API_KEY: ${CF_API_KEY} 17 | volumes: 18 | - ./data:/data 19 | - ./fake.jar:/servers/fake.jar:ro 20 | - ./listing.txt:/extras/listing.txt:ro 21 | -------------------------------------------------------------------------------- /tests/setuponlytests/cf_files/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/cf_files/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/cf_files/listing.txt: -------------------------------------------------------------------------------- 1 | architectury-api@9.2.14 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/cf_files/require.sh: -------------------------------------------------------------------------------- 1 | [[ $CF_API_KEY ]] || exit 1 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/cf_files/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/mods/architectury-*-fabric.jar" 2 | mc-image-helper assert fileExists "/data/mods/Clumps-fabric-*.jar" 3 | mc-image-helper assert fileExists "/data/mods/fabric-api-*.jar" 4 | mc-image-helper assert fileExists "/data/mods/jei-*-fabric-*.jar" 5 | 6 | -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_spigot_server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | VERSION: ${MINECRAFT_VERSION:-LATEST} 9 | TYPE: "PAPER" 10 | WORLD: /worlds/world-for-testing.zip 11 | volumes: 12 | - ./worlds:/worlds:ro 13 | - ./data:/data 14 | -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_spigot_server/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_spigot_server/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists \ 2 | world/level.dat \ 3 | world_nether/DIM-1/some_spigot_nether_file \ 4 | world_the_end/DIM1/some_spigot_end_file 5 | mc-image-helper assert fileNotExists \ 6 | world_nether/DIM-1/some_vanilla_nether_file \ 7 | world_the_end/DIM1/some_vanilla_end_file 8 | -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_spigot_server/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/conflicting_world_for_spigot_server/worlds/world-for-testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_vanilla_server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | WORLD: /worlds/world-for-testing.zip 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./worlds:/worlds:ro 15 | - ./data:/data 16 | # the following are only used to speed up test execution 17 | - ./verify.sh:/servers/fake.jar 18 | -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_vanilla_server/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_vanilla_server/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat && \ 2 | mc-image-helper assert fileExists world/DIM-1/some_spigot_nether_file && \ 3 | mc-image-helper assert fileExists world/DIM1/some_spigot_end_file && \ 4 | ! mc-image-helper assert fileExists world/DIM-1/some_vanilla_nether_file && \ 5 | ! mc-image-helper assert fileExists world/DIM1/some_vanilla_end_file 6 | -------------------------------------------------------------------------------- /tests/setuponlytests/conflicting_world_for_vanilla_server/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/conflicting_world_for_vanilla_server/worlds/world-for-testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/curseforge/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server:java8-multiarch} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "TRUE" 7 | TYPE: CURSEFORGE 8 | CF_SERVER_MOD: /modpacks/pack.zip 9 | INIT_MEMORY: 2G 10 | MAX_MEMORY: 6G 11 | volumes: 12 | - ./data:/data 13 | - ./modpacks:/modpacks:ro 14 | 15 | -------------------------------------------------------------------------------- /tests/setuponlytests/curseforge/modpacks/pack.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/curseforge/modpacks/pack.zip -------------------------------------------------------------------------------- /tests/setuponlytests/curseforge/require.sh: -------------------------------------------------------------------------------- 1 | [[ $VARIANT == java8* ]] || exit 1 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/curseforge/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/FeedTheBeast/forge-installer.jar" 2 | mc-image-helper assert fileExists "/data/FeedTheBeast/forge.jar" 3 | -------------------------------------------------------------------------------- /tests/setuponlytests/defaults/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | volumes: 9 | - ./data:/data 10 | -------------------------------------------------------------------------------- /tests/setuponlytests/defaults/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert propertyEquals --file=server.properties --property=rcon.port --expect=25575 2 | mc-image-helper assert propertyEquals --file=server.properties --property=enable-rcon --expect=true 3 | -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs-prefix/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "TRUE" 7 | GENERIC_PACKS: testing 8 | GENERIC_PACKS_PREFIX: /packs/ 9 | GENERIC_PACKS_SUFFIX: .zip 10 | DEBUG: "true" 11 | # the following are only used to speed up test execution 12 | TYPE: CUSTOM 13 | CUSTOM_SERVER: /servers/fake.jar 14 | VERSION: 1.18.1 15 | volumes: 16 | - ./packs:/packs 17 | - ./data:/data 18 | # the following are only used to speed up test execution 19 | - ./verify.sh:/servers/fake.jar 20 | -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs-prefix/packs/testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/generic-packs-prefix/packs/testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs-prefix/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists one.txt mods/two.txt 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | image: nginx 4 | volumes: 5 | - ./web:/usr/share/nginx/html 6 | mc: 7 | depends_on: 8 | - web 9 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 10 | environment: 11 | EULA: "true" 12 | SETUP_ONLY: "true" 13 | GENERIC_PACKS: http://web/configs.zip,/packs/testing.zip 14 | LOG_TIMESTAMP: "true" 15 | # the following are only used to speed up test execution 16 | TYPE: CUSTOM 17 | CUSTOM_SERVER: /servers/fake.jar 18 | VERSION: 1.18.1 19 | DEBUG: "true" 20 | volumes: 21 | - ./packs:/packs 22 | - ./data:/data 23 | - ./fake.jar:/servers/fake.jar 24 | -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/generic-packs/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs/packs/testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/generic-packs/packs/testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists one.txt mods/two.txt 2 | mc-image-helper assert fileExists config/opt.yml -------------------------------------------------------------------------------- /tests/setuponlytests/generic-packs/web/configs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/generic-packs/web/configs.zip -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-exact/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "true" 7 | ICON: /extra/4737386_minecraft_squircle_icon_64x64.png 8 | # the following are only used to speed up test execution 9 | TYPE: CUSTOM 10 | CUSTOM_SERVER: /servers/fake.jar 11 | VERSION: 1.18.1 12 | volumes: 13 | - ./data:/data 14 | - ./extra:/extra 15 | - ./fake.jar:/servers/fake.jar 16 | -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-exact/extra/4737386_minecraft_squircle_icon_64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-file-exact/extra/4737386_minecraft_squircle_icon_64x64.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-exact/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-file-exact/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-exact/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-exact/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists server-icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-scale/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "true" 7 | ICON: /extra/4737386_minecraft_squircle_icon.png 8 | # the following are only used to speed up test execution 9 | TYPE: CUSTOM 10 | CUSTOM_SERVER: /servers/fake.jar 11 | VERSION: 1.18.1 12 | volumes: 13 | - ./data:/data 14 | - ./extra:/extra 15 | - ./fake.jar:/servers/fake.jar 16 | -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-scale/extra/4737386_minecraft_squircle_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-file-scale/extra/4737386_minecraft_squircle_icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-scale/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-file-scale/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/icon-file-scale/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists server-icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-gif-multiframe/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | image: nginx 4 | volumes: 5 | - ./web:/usr/share/nginx/html 6 | mc: 7 | depends_on: 8 | - web 9 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 10 | environment: 11 | EULA: "true" 12 | SETUP_ONLY: "true" 13 | ICON: http://web/motion-tween-example.gif 14 | # the following are only used to speed up test execution 15 | TYPE: CUSTOM 16 | CUSTOM_SERVER: /servers/fake.jar 17 | VERSION: 1.18.1 18 | volumes: 19 | - ./data:/data 20 | - ./fake.jar:/servers/fake.jar 21 | -------------------------------------------------------------------------------- /tests/setuponlytests/icon-gif-multiframe/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-gif-multiframe/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/icon-gif-multiframe/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/icon-gif-multiframe/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists server-icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-gif-multiframe/web/motion-tween-example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-gif-multiframe/web/motion-tween-example.gif -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-atscale/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | image: nginx 4 | volumes: 5 | - ./web:/usr/share/nginx/html 6 | mc: 7 | depends_on: 8 | - web 9 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 10 | environment: 11 | EULA: "true" 12 | SETUP_ONLY: "true" 13 | ICON: http://web/4737386_minecraft_squircle_icon.png 14 | # the following are only used to speed up test execution 15 | TYPE: CUSTOM 16 | CUSTOM_SERVER: /servers/fake.jar 17 | VERSION: 1.18.1 18 | volumes: 19 | - ./data:/data 20 | - ./fake.jar:/servers/fake.jar 21 | -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-atscale/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-png-atscale/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-atscale/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-atscale/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists server-icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-atscale/web/4737386_minecraft_squircle_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-png-atscale/web/4737386_minecraft_squircle_icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-scale/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | image: nginx 4 | volumes: 5 | - ./web:/usr/share/nginx/html 6 | mc: 7 | depends_on: 8 | - web 9 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 10 | environment: 11 | EULA: "true" 12 | SETUP_ONLY: "true" 13 | ICON: http://web/4737386_minecraft_squircle_icon.png 14 | # the following are only used to speed up test execution 15 | TYPE: CUSTOM 16 | CUSTOM_SERVER: /servers/fake.jar 17 | VERSION: 1.18.1 18 | volumes: 19 | - ./data:/data 20 | - ./fake.jar:/servers/fake.jar 21 | -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-scale/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-png-scale/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-scale/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists server-icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/icon-png-scale/web/4737386_minecraft_squircle_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/icon-png-scale/web/4737386_minecraft_squircle_icon.png -------------------------------------------------------------------------------- /tests/setuponlytests/modrinth/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "true" 7 | TYPE: FABRIC 8 | VERSION: 1.21.4 9 | MODRINTH_PROJECTS: fabric-api,cloth-config 10 | volumes: 11 | - ./data:/data 12 | -------------------------------------------------------------------------------- /tests/setuponlytests/modrinth/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "mods/cloth-config-*.jar" "mods/fabric-api-*.jar" -------------------------------------------------------------------------------- /tests/setuponlytests/mounts-custom/custom/config/test.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /tests/setuponlytests/mounts-custom/custom/mods/mod.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/mounts-custom/custom/mods/mod.jar -------------------------------------------------------------------------------- /tests/setuponlytests/mounts-custom/custom/plugins/plugin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/mounts-custom/custom/plugins/plugin.jar -------------------------------------------------------------------------------- /tests/setuponlytests/mounts-custom/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 4 | environment: 5 | EULA: "true" 6 | SETUP_ONLY: "true" 7 | TYPE: CUSTOM 8 | CUSTOM_SERVER: /servers/fake.jar 9 | VERSION: 1.18.1 10 | COPY_PLUGINS_SRC: /custom/plugins 11 | COPY_PLUGINS_DEST: /data/custom-plugins 12 | COPY_MODS_SRC: /custom/mods 13 | COPY_MODS_DEST: /data/custom-mods 14 | COPY_CONFIG_SRC: /custom/config 15 | COPY_CONFIG_DEST: /data/custom-config 16 | volumes: 17 | - ./data:/data 18 | - ./custom:/custom 19 | - ./fake.jar:/servers/fake.jar 20 | -------------------------------------------------------------------------------- /tests/setuponlytests/mounts-custom/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/mounts-custom/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/mounts-custom/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists custom-plugins/plugin.jar 2 | mc-image-helper assert fileExists custom-mods/mod.jar 3 | mc-image-helper assert fileExists custom-config/test.json 4 | -------------------------------------------------------------------------------- /tests/setuponlytests/ops_from_scratch/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | OPS: itzg 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./data:/data 15 | # the following are only used to speed up test execution 16 | - ./verify.sh:/servers/fake.jar 17 | -------------------------------------------------------------------------------- /tests/setuponlytests/ops_from_scratch/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert jsonPathEquals --file=ops.json --path='$[0].name' --expect=itzg 2 | mc-image-helper assert jsonPathEquals --file=ops.json --path='$[0].uuid' --expect=5cddfd26-fc86-4981-b52e-c42bb10bfdef 3 | mc-image-helper assert jsonPathEquals --file=ops.json --path='$[0].level' --expect=4 -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | image: nginx 4 | volumes: 5 | - ./web:/usr/share/nginx/html 6 | mc: 7 | depends_on: 8 | - web 9 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 10 | environment: 11 | EULA: "true" 12 | PACKWIZ_URL: http://web/pack.toml 13 | TYPE: CUSTOM 14 | CUSTOM_SERVER: /servers/fake.jar 15 | VERSION: 1.19 16 | DEBUG_HELPER: "true" 17 | volumes: 18 | - ./data:/data 19 | - ./fake.jar:/servers/fake.jar 20 | -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/fake.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/packwiz/fake.jar -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/require.sh: -------------------------------------------------------------------------------- 1 | # maven.packwiz.infra.link is not resolvable 2 | exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists mods/architectury-5.7.28-fabric.jar 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/web/index.toml: -------------------------------------------------------------------------------- 1 | hash-format = "sha256" 2 | 3 | [[files]] 4 | file = "mods/architectury-api.pw.toml" 5 | hash = "c20179449fff711afb96ba0eadd3328fbf1aae639082d25d77c9080837685b79" 6 | metafile = true -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/web/mods/architectury-api.pw.toml: -------------------------------------------------------------------------------- 1 | name = "Architectury API" 2 | filename = "architectury-5.7.28-fabric.jar" 3 | side = "both" 4 | 5 | [download] 6 | url = "https://cdn.modrinth.com/data/lhGA9TYQ/versions/5.7.28+fabric/architectury-5.7.28-fabric.jar" 7 | hash-format = "sha1" 8 | hash = "aa38ae9cc2e978e4ec87ff891f7b02ea0c0ee1b8" 9 | 10 | [update] 11 | [update.modrinth] 12 | mod-id = "lhGA9TYQ" 13 | version = "Hf0Bau1j" -------------------------------------------------------------------------------- /tests/setuponlytests/packwiz/web/pack.toml: -------------------------------------------------------------------------------- 1 | name = "Vanillia Server" 2 | author = "itzg" 3 | version = "2.0.0" 4 | pack-format = "packwiz:1.1.0" 5 | 6 | [index] 7 | file = "index.toml" 8 | hash-format = "sha256" 9 | hash = "1a27b406c3fb6d35167fe659384ab528a6b3f8a66e6c05d593058e646aec591f" 10 | 11 | [versions] 12 | fabric = "0.14.8" 13 | minecraft = "1.19" -------------------------------------------------------------------------------- /tests/setuponlytests/pufferfish/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: PUFFERFISH 9 | VERSION: ${MINECRAFT_VERSION:-LATEST} 10 | volumes: 11 | - ./data:/data 12 | -------------------------------------------------------------------------------- /tests/setuponlytests/pufferfish/require.sh: -------------------------------------------------------------------------------- 1 | [[ $MINECRAFT_VERSION == LATEST ]] || exit 1 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/pufferfish/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/pufferfish-*.jar" 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/quilt/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: QUILT 9 | VERSION: ${MINECRAFT_VERSION:-LATEST} 10 | volumes: 11 | - ./data:/data 12 | -------------------------------------------------------------------------------- /tests/setuponlytests/quilt/require.sh: -------------------------------------------------------------------------------- 1 | [[ $MINECRAFT_VERSION == LATEST ]] || exit 1 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/quilt/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/quilt-server-*-launch.jar" 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/spiget/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: PAPER 9 | # jar doesn't need to exist for setuponly tests 10 | PAPER_CUSTOM_JAR: /servers/fake.jar 11 | SPIGET_RESOURCES: "34315,3836,6245,2124" 12 | volumes: 13 | - ./data:/data 14 | -------------------------------------------------------------------------------- /tests/setuponlytests/spiget/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/spiget/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists plugins/3836.jar 2 | mc-image-helper assert fileExists plugins/34315.jar 3 | mc-image-helper assert fileExists plugins/6245.jar 4 | mc-image-helper assert fileExists plugins/SkinsRestorer.jar -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_spigot_server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: "PAPER" 9 | WORLD: /worlds/world-for-testing.zip 10 | # the following are only used to speed up test execution 11 | VERSION: 1.18.1 12 | PAPER_CUSTOM_JAR: /servers/fake.jar 13 | volumes: 14 | - ./worlds:/worlds:ro 15 | - ./data:/data 16 | -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_spigot_server/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat && \ 2 | mc-image-helper assert fileExists world/some_overworld_file && \ 3 | mc-image-helper assert fileExists world_nether/DIM-1/some_nether_file && \ 4 | mc-image-helper assert fileExists world_the_end/DIM1/some_end_file 5 | -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_spigot_server/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/spigot_world_for_spigot_server/worlds/world-for-testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_vanilla_server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | WORLD: /worlds/world-for-testing.zip 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./worlds:/worlds:ro 15 | - ./data:/data 16 | # the following are only used to speed up test execution 17 | - ./verify.sh:/servers/fake.jar 18 | -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_vanilla_server/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_vanilla_server/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat && \ 2 | mc-image-helper assert fileExists world/some_overworld_file && \ 3 | mc-image-helper assert fileExists world/DIM-1/some_nether_file && \ 4 | mc-image-helper assert fileExists world/DIM1/some_end_file 5 | -------------------------------------------------------------------------------- /tests/setuponlytests/spigot_world_for_vanilla_server/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/spigot_world_for_vanilla_server/worlds/world-for-testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/spongevanilla_version_compare/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: "SPONGEVANILLA" 9 | SPONGEVERSION: "1.12.2-7.3.1-RC391" 10 | DIFFICULTY: "0" 11 | 12 | volumes: 13 | - ./data:/data 14 | -------------------------------------------------------------------------------- /tests/setuponlytests/spongevanilla_version_compare/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/spongevanilla_version_compare/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert propertyEquals --file=server.properties --property=difficulty --expect=0 2 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_spigot_server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | TYPE: "PAPER" 9 | WORLD: /worlds/world-for-testing.zip 10 | # the following are only used to speed up test execution 11 | VERSION: 1.18.1 12 | PAPER_CUSTOM_JAR: /servers/fake.jar 13 | volumes: 14 | - ./worlds:/worlds:ro 15 | - ./data:/data 16 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_spigot_server/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_spigot_server/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat && \ 2 | mc-image-helper assert fileExists world_nether/DIM-1/some_nether_file && \ 3 | mc-image-helper assert fileExists world_the_end/DIM1/some_end_file 4 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_spigot_server/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/vanilla_world_for_spigot_server/worlds/world-for-testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_vanilla_server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | WORLD: /worlds/world-for-testing.zip 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./worlds:/worlds:ro 15 | - ./data:/data 16 | # the following are only used to speed up test execution 17 | - ./verify.sh:/servers/fake.jar 18 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_vanilla_server/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat && \ 2 | mc-image-helper assert fileExists world/DIM-1/some_nether_file && \ 3 | mc-image-helper assert fileExists world/DIM1/some_end_file 4 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanilla_world_for_vanilla_server/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/vanilla_world_for_vanilla_server/worlds/world-for-testing.zip -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_file/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | VANILLATWEAKS_FILE: /config/vt-datapacks.json,/config/vt-craftingtweaks.json 7 | EULA: "TRUE" 8 | SETUP_ONLY: "TRUE" 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./data:/data 15 | - ./vt-datapacks.json:/config/vt-datapacks.json:ro 16 | - ./vt-craftingtweaks.json:/config/vt-craftingtweaks.json:ro 17 | # the following are only used to speed up test execution 18 | - ./verify.sh:/servers/fake.jar 19 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_file/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_file/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/world/datapacks/afk*" 2 | mc-image-helper assert fileExists "/data/world/datapacks/graves*" 3 | mc-image-helper assert fileExists "/data/world/datapacks/VanillaTweaks_*" 4 | mc-image-helper assert fileExists "/data/resourcepacks/VanillaTweaks_*" 5 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_file/vt-craftingtweaks.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "craftingtweaks", 3 | "version": "1.18", 4 | "packs": { 5 | "quality of life": [ 6 | "dropper to dispenser", 7 | "double slabs", 8 | "back to blocks" 9 | ] 10 | }, 11 | "result": "ok" 12 | } -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_file/vt-datapacks.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "datapacks", 3 | "version": "1.18", 4 | "packs": { 5 | "survival": [ 6 | "graves", 7 | "multiplayer sleep", 8 | "afk display", 9 | "armor statues", 10 | "unlock all recipes", 11 | "fast leaf decay", 12 | "coordinates hud" 13 | ], 14 | "items": ["armored elytra"] 15 | }, 16 | "result": "ok" 17 | } 18 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_file/vt-resourcepacks.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "resourcepacks", 3 | "version": "1.18", 4 | "packs": { 5 | "aesthetic": ["CherryPicking", "BlackNetherBricks", "AlternateBlockDestruction"] 6 | }, 7 | "result": "ok" 8 | } -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_sharecode/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | VANILLATWEAKS_SHARECODE: MGr52E,tF1zL2,LnEDwT 7 | EULA: "TRUE" 8 | SETUP_ONLY: "TRUE" 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./data:/data 15 | # the following are only used to speed up test execution 16 | - ./verify.sh:/servers/fake.jar 17 | -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_sharecode/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/vanillatweaks_sharecode/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists "/data/world/datapacks/afk*" 2 | mc-image-helper assert fileExists "/data/world/datapacks/graves*" 3 | mc-image-helper assert fileExists "/data/world/datapacks/VanillaTweaks_488158f.zip" 4 | mc-image-helper assert fileExists "/data/resourcepacks/VanillaTweaks_d1d810f.zip" 5 | -------------------------------------------------------------------------------- /tests/setuponlytests/whitelist_from_scratch/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | WHITELIST: itzg 9 | ENFORCE_WHITELIST: "true" 10 | OVERRIDE_SERVER_PROPERTIES: "true" 11 | # the following are only used to speed up test execution 12 | TYPE: CUSTOM 13 | CUSTOM_SERVER: /servers/fake.jar 14 | VERSION: 1.18.1 15 | volumes: 16 | - ./data:/data 17 | # the following are only used to speed up test execution 18 | - ./verify.sh:/servers/fake.jar 19 | -------------------------------------------------------------------------------- /tests/setuponlytests/whitelist_from_scratch/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert jsonPathEquals --file=whitelist.json --path='$[0].name' --expect=itzg 2 | mc-image-helper assert jsonPathEquals --file=whitelist.json --path='$[0].uuid' --expect=5cddfd26-fc86-4981-b52e-c42bb10bfdef 3 | mc-image-helper assert propertyEquals --file=server.properties --property=white-list --expect=true 4 | mc-image-helper assert propertyEquals --file=server.properties --property=enforce-whitelist --expect=true 5 | -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tar/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | WORLD: /worlds/world-for-testing.tar 9 | # the following are only used to speed up test execution 10 | TYPE: CUSTOM 11 | CUSTOM_SERVER: /servers/fake.jar 12 | VERSION: 1.18.1 13 | volumes: 14 | - ./worlds:/worlds:ro 15 | - ./data:/data 16 | # the following are only used to speed up test execution 17 | - ./verify.sh:/servers/fake.jar 18 | -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tar/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tar/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarbz2/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | VERSION: ${MINECRAFT_VERSION:-LATEST} 9 | WORLD: /worlds/world-for-testing.tar.bz2 10 | volumes: 11 | - ./worlds:/worlds:ro 12 | - ./data:/data 13 | -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarbz2/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarbz2/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarbz2/worlds/world-for-testing.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/world_from_tarbz2/worlds/world-for-testing.tar.bz2 -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_targz/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | VERSION: ${MINECRAFT_VERSION:-LATEST} 9 | WORLD: /worlds/world-for-testing.tar.gz 10 | volumes: 11 | - ./worlds:/worlds:ro 12 | - ./data:/data 13 | -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_targz/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_targz/worlds/world-for-testing.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/world_from_targz/worlds/world-for-testing.tar.gz -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarzst/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | VERSION: ${MINECRAFT_VERSION:-LATEST} 9 | WORLD: /worlds/world-for-testing.tar.zst 10 | volumes: 11 | - ./worlds:/worlds:ro 12 | - ./data:/data 13 | -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarzst/require.sh: -------------------------------------------------------------------------------- 1 | [[ $EXTENDED_TESTS ]] || exit 1 -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarzst/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_tarzst/worlds/world-for-testing.tar.zst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzg/docker-minecraft-server/d622dbc2a95640e28a15914b6b82c6c6502e0f42/tests/setuponlytests/world_from_tarzst/worlds/world-for-testing.tar.zst -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_zip/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mc: 3 | restart: "no" 4 | image: ${IMAGE_TO_TEST:-itzg/minecraft-server} 5 | environment: 6 | EULA: "TRUE" 7 | SETUP_ONLY: "TRUE" 8 | VERSION: ${MINECRAFT_VERSION:-LATEST} 9 | WORLD: /worlds/world-for-testing.zip 10 | volumes: 11 | - ./worlds:/worlds:ro 12 | - ./data:/data 13 | -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_zip/verify.sh: -------------------------------------------------------------------------------- 1 | mc-image-helper assert fileExists world/level.dat -------------------------------------------------------------------------------- /tests/setuponlytests/world_from_zip/worlds/world-for-testing.zip: -------------------------------------------------------------------------------- 1 | PKN|7T level.datPKN|7T level.datPK7' -------------------------------------------------------------------------------- /tests/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | # go to script root directory 6 | cd "$(dirname "$0")" || exit 1 7 | 8 | # go through top level folders and trigger the tests in the subfolders 9 | readarray -t folders < <(find . -maxdepth 2 -mindepth 2 -name test.sh -printf '%h\n') 10 | for folder in "${folders[@]}"; do 11 | cd "$folder" 12 | echo "Starting ${folder} Tests" 13 | bash ./test.sh 14 | cd .. 15 | done 16 | --------------------------------------------------------------------------------