Files
blog-ahmza-com/public/posts/minecraft-server-on-docker/index.html
T
2023-11-10 23:24:28 +00:00

72 lines
30 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html><html lang=en dir=auto><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=robots content="index, follow"><title>Minecraft Server on Docker ⛏ 🐳 | ahmza's ramblings</title>
<meta name=keywords content="Games,Docker,ARM"><meta name=description content="Ever wanted to build a Minecraft server in docker !! Start here"><meta name=author content="ahmza"><link rel=canonical href=https://blog.ahmza.com/Page%28/posts/minecraft-server-on-docker.md%29><link crossorigin=anonymous href=/assets/css/stylesheet.49e35863ac4b53ab71c7e3249dd5e722c701ee07f8d0cb006a4f4e954364b6fe.css integrity="sha256-SeNYY6xLU6txx+MkndXnIscB7gf40MsAak9OlUNktv4=" rel="preload stylesheet" as=style><script defer crossorigin=anonymous src=/assets/js/highlight.f413e19d0714851f6474e7ee9632408e58ac146fbdbe62747134bea2fa3415e0.js integrity="sha256-9BPhnQcUhR9kdOfuljJAjlisFG+9vmJ0cTS+ovo0FeA=" onload=hljs.initHighlightingOnLoad()></script><link rel=icon href=https://blog.ahmza.com/img/favicon.png><link rel=icon type=image/png sizes=16x16 href=https://blog.ahmza.com/img/favicon.png><link rel=icon type=image/png sizes=32x32 href=https://blog.ahmza.com/img/favicon.png><link rel=apple-touch-icon href=https://blog.ahmza.com/img/favicon.png><link rel=mask-icon href=https://blog.ahmza.com/img/favicon.png><meta name=theme-color content="#2e2e33"><meta name=msapplication-TileColor content="#2e2e33"><noscript><style>#theme-toggle,.top-link{display:none}</style></noscript><script async src="https://www.googletagmanager.com/gtag/js?id=G-HSJHLHP8FZ"></script><script>var doNotTrack=!1;if(!doNotTrack){window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag("js",new Date),gtag("config","G-HSJHLHP8FZ",{anonymize_ip:!1})}</script><meta property="og:title" content="Minecraft Server on Docker ⛏ 🐳"><meta property="og:description" content="Ever wanted to build a Minecraft server in docker !! Start here"><meta property="og:type" content="article"><meta property="og:url" content="https://blog.ahmza.com/posts/minecraft-server-on-docker/"><meta property="og:image" content="https://blog.ahmza.com/webp/posts/mc-docker/feature-anim.webp"><meta property="article:section" content="posts"><meta property="article:published_time" content="2022-05-24T09:33:35+01:00"><meta property="article:modified_time" content="2022-05-24T09:33:35+01:00"><meta property="og:site_name" content="ahmza's ramblings"><meta name=twitter:card content="summary_large_image"><meta name=twitter:image content="https://blog.ahmza.com/webp/posts/mc-docker/feature-anim.webp"><meta name=twitter:title content="Minecraft Server on Docker ⛏ 🐳"><meta name=twitter:description content="Ever wanted to build a Minecraft server in docker !! Start here"><script type=application/ld+json>{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":2,"name":"Posts","item":"https://blog.ahmza.com/posts/"},{"@type":"ListItem","position":3,"name":"Minecraft Server on Docker ⛏ 🐳","item":"https://blog.ahmza.com/posts/minecraft-server-on-docker/"}]}</script><script type=application/ld+json>{"@context":"https://schema.org","@type":"BlogPosting","headline":"Minecraft Server on Docker ⛏ 🐳","name":"Minecraft Server on Docker ⛏ 🐳","description":"Ever wanted to build a Minecraft server in docker !! Start here","keywords":["Games","Docker","ARM"],"articleBody":"Introduction Minecraft is a great game and when it comes to multiplayer, a dedicated server is the way to go (here’s why1). Myself and a few others recently decided to start playing this game again, and I took the opportunity to deploy the server in my lab.\nA Minecraft server does not require a ton of resources to run, However from my experience the more resources you can throw at it the better, especially when you start to introduce mods and more than a few players.\nI run our server on my main PC within WSL and Docker. This allows me to leverage the system resources in my PC 🦾 leaving the Pi Cluster to handle the rest of the stuff in my lab. The only reason I opted to go this route is that I don’t want our server to be limited by hardware resources as well as the Minecraft server effecting the overall performance of the Pis.\nPrerequisites Docker Docker Compose Requirements2 Minimum (1-5 Players) Intel Pentium 4 or AMD Athlon based CPU 512 MB RAM 2 GB Storage space Recommended (10-15 Players) Intel Core or AMD K8 based CPU 3 GB RAM 16 GB Storage Space Optimal (20+ Players) Intel i5/i7 or AMD Ryzen 5/7 Based CPU 6 GB RAM 35 GB Storage Space Building the Container Now we have the formalities sorted, we can get to work on creating the docker container for Minecraft.\nCreate a directory in which you will keep the Minecraft server files\nmkdir minecraft-server cd minecraft-server Create an environment file to be used by the Docker Container\nThe .env file allows us to specify variables which we can use across the build process. touch .env Edit the file in a text editor, i.e. vim vim .env CONTAINER_NAME=minecraft-server SERVER_MEM=4096 #change this to your desired value (in MB) SERVER_JAR=minecraft_server.1.18.2.jar Create the docker-compose.yml file\nThe docker-compose.yml file specifies the container that we want to build, outlining the build context (Dockerfile), setting the variables (from .env), configuring storage volumes for persistence as well as ports and the container name. touch docker-compose.yml Edit the file in a text editor3, I.e. vim vim docker-compose.yml version: \"3\" services: minecraft-server: build: context: . args: SERVER_MEM: ${SERVER_MEM} SERVER_JAR: ${SERVER_JAR} volumes: - .server-data:/server ports: - 25565:25565 - 25575:25575 container_name: ${CONTAINER_NAME} restart: unless-stopped volumes: server-data: Create the Dockerfile file\nThe Dockerfile builds the container. We take the 17-jre base image apply our variables change the working directory to /server and start the jar file, effectively starting the Minecraft server. touch Dockerfile Edit the file in a text editor, i.e. vim vim Dockerfile FROM eclipse-temurin:17-jre ARG SERVER_MEM ARG SERVER_JAR ENV SERVER_MEM=${SERVER_MEM} ENV SERVER_JAR=${SERVER_JAR} WORKDIR /server CMD echo \"Minecraft Server is starting\\n\" \u0026\u0026 java -Xms128M -Xmx${SERVER_MEM}M -jar ${SERVER_JAR} nogui Setup the Server files We’re almost there, just a few steps left !!\nThe curious among you may have realised when trying to start the container that it fails with the error below:\nMinecraft Server is starting Error: Unable to access jarfile server.jar This is because we have not downloaded the server jar file yet, that is our next step.\nNavigate to one of the following sites:4 Vanilla Minecraft Server - instructions found here5 Fabric Mod loader server - instructions found here 6 Create a folder in the Minecraft-server folder called .server-data mkdir .server-data cd .server-data Download the jar file - This will depend on the option above so read the instructions Go back to the root minecraft-server folder cd .. Run the container docker compose up (use CTRL+C to exit) Once the server unpacks all the files you will see this: minecraft-server | Starting net.minecraft.server.Main minecraft-server | [18:05:50] [ServerMain/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info. minecraft-server exited with code 0 Accept the EULA Go into the .server-data folder cd .server-data Edit the file named eula.txt in a text editor i.e. vim vim eula.txt Simply change eula=false to eula=true While in the .server-data folder make any changes you want Some files to note in here are server.properties - properties like server name, game mode, world type etc… ops.json - list of server operators (easier to set ingame) whitelist.json - list of players allowed to join the server everyone else rejected access. Run the container docker compose up -d (the -d means detatched so we can run the server in the background) docker logs minecraft-server --follow Will show us the progress of the server startup (to exit out of this do CTRL+C) If you see something like the following then you’re a winner 🥳 [18:17:01] [Server thread/INFO]: Time elapsed: 25529 ms [18:17:01] [Server thread/INFO]: Done (34.571s)! For help, type \"help\" Conclusion Well done you have successfully setup a Minecraft server, now go play !! There is a lot of cool stuff you can do with a Minecraft server for example installing mods or creating scripts to manage the server, this will be covered in the next post so keep an eye out for it !!\nHosting your own dedicated server allows you to modify every aspect of the server as you see fit. I.E you can modify the server-properties, you can implement a whitelist not to mention being able to add any mods you want ↩︎\nRequirements Gathered from here https://minecraft.fandom.com/wiki/Server/Requirements/Dedicated#Unix_.28Linux.2C_BSD.2C_macOS.29 ↩︎\nYaml is very picky 😞 when it comes to formatting so if you encounter any errors double check your formatting !! ↩︎\nI have left Forge out as it is a more involved process plus Fabric is better 😜 ↩︎\nRight click the green link that says something like minecraft_server.x.xx.x.jar and copy the link address\ncurl -o server.jar ↩︎\nSelect the Minecraft version, Fabric Loader Version and the Installer Version of your choice. I tend to go with the latest.\nCopy the curl command under CLI download ↩︎\n","wordCount":"965","inLanguage":"en","image":"https://blog.ahmza.com/webp/posts/mc-docker/feature-anim.webp","datePublished":"2022-05-24T09:33:35+01:00","dateModified":"2022-05-24T09:33:35+01:00","author":{"@type":"Person","name":"ahmza"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://blog.ahmza.com/posts/minecraft-server-on-docker/"},"publisher":{"@type":"Organization","name":"ahmza's ramblings","logo":{"@type":"ImageObject","url":"https://blog.ahmza.com/img/favicon.png"}}}</script></head><body class=dark id=top><script>localStorage.getItem("pref-theme")==="light"&&document.body.classList.remove("dark")</script><header class=header><nav class=nav><div class=logo><a href=https://blog.ahmza.com accesskey=h title="ahmza's ramblings (Alt + H)">ahmza's ramblings</a><div class=logo-switches><button id=theme-toggle accesskey=t title="(Alt + T)"><svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></button></div></div><ul id=menu><li><a href=https://blog.ahmza.com/posts/ title=posts><span>posts</span></a></li><li><a href=https://blog.ahmza.com/archives/ title=archive><span>archive</span></a></li><li><a href=https://blog.ahmza.com/tags/ title=tags><span>tags</span></a></li><li><a href=https://blog.ahmza.com/contact title=contact><span>contact</span></a></li><li><a href=https://blog.ahmza.com/search/ title="search (Alt + /)" accesskey=/><span>search</span></a></li></ul></nav></header><main class=main><article class=post-single><header class=post-header><div class=breadcrumbs><a href=https://blog.ahmza.com>Home</a>&nbsp;»&nbsp;<a href=https://blog.ahmza.com/posts/>Posts</a></div><h1 class=post-title>Minecraft Server on Docker ⛏ 🐳</h1><div class=post-description>Ever wanted to build a Minecraft server in docker !! Start here</div><div class=post-meta>&lt;span title='2022-05-24 09:33:35 +0100 BST'>May 24, 2022&lt;/span>&amp;nbsp;·&amp;nbsp;5 min&amp;nbsp;·&amp;nbsp;965 words&amp;nbsp;·&amp;nbsp;ahmza&nbsp;|&nbsp;<a href=https://gitlab.com/AHMZA/blog/-/blob/main/content/posts/minecraft-server-on-docker.md rel="noopener noreferrer" target=_blank>Suggest Changes</a></div></header><figure class=entry-cover><img loading=lazy src=https://blog.ahmza.com/webp/posts/mc-docker/feature-anim.webp alt="Minecraft Loves Docker"><p></p></figure><div class=toc><details><summary accesskey=c title="(Alt + C)"><span class=details>Table of Contents</span></summary><div class=inner><ul><li><a href=#introduction aria-label=Introduction><strong>Introduction</strong></a></li><li><a href=#prerequisites aria-label=Prerequisites><strong>Prerequisites</strong></a></li><li><a href=#requirements2 aria-label=Requirements2><strong>Requirements</strong><sup id=fnref:2><a href=#fn:2 class=footnote-ref role=doc-noteref>2</a></sup></a><ul><ul><li><a href=#minimum-1-5-players aria-label="Minimum (1-5 Players)"><strong>Minimum (1-5 Players)</strong></a></li><li><a href=#recommended-10-15-players aria-label="Recommended (10-15 Players)"><strong>Recommended (10-15 Players)</strong></a></li><li><a href=#optimal-20-players aria-label="Optimal (20+ Players)"><strong>Optimal (20+ Players)</strong></a></li></ul></ul></li><li><a href=#building-the-container aria-label="Building the Container"><strong>Building the Container</strong></a></li><li><a href=#setup-the-server-files aria-label="Setup the Server files"><strong>Setup the Server files</strong></a></li><li><a href=#conclusion aria-label=Conclusion>Conclusion</a></li></ul></div></details></div><div class=post-content><h2 id=introduction><strong>Introduction</strong><a hidden class=anchor aria-hidden=true href=#introduction>#</a></h2><p>Minecraft is a great game and when it comes to multiplayer, a dedicated
server is the way to go (here&rsquo;s why<sup id=fnref:1><a href=#fn:1 class=footnote-ref role=doc-noteref>1</a></sup>). Myself and a few others
recently decided to start playing this game again, and I took the
opportunity to deploy the server in my lab.</p><p>A Minecraft server does not require a ton of resources to run, However
from my experience the more resources you can throw at it the better,
especially when you start to introduce mods and more than a few players.</p><p>I run our server on my main PC within WSL and Docker. This allows me to
leverage the system resources in my PC 🦾 leaving the <a href=https://blog.ahmza.com/posts/building-a-docker-swarm-with-pis/ target=_blank>Pi Cluster</a>
to handle the rest of the stuff in my lab. The only reason I opted to
go this route is that I don’t want our server to be limited by hardware
resources as well as the Minecraft server effecting the overall
performance of the Pis.</p><h2 id=prerequisites><strong>Prerequisites</strong><a hidden class=anchor aria-hidden=true href=#prerequisites>#</a></h2><ul><li>Docker</li><li>Docker Compose</li></ul><h2 id=requirements2><strong>Requirements</strong><sup id=fnref:2><a href=#fn:2 class=footnote-ref role=doc-noteref>2</a></sup><a hidden class=anchor aria-hidden=true href=#requirements2>#</a></h2><h4 id=minimum-1-5-players><strong>Minimum (1-5 Players)</strong><a hidden class=anchor aria-hidden=true href=#minimum-1-5-players>#</a></h4><ul><li>Intel Pentium 4 or AMD Athlon based CPU</li><li>512 MB RAM</li><li>2 GB Storage space</li></ul><h4 id=recommended-10-15-players><strong>Recommended (10-15 Players)</strong><a hidden class=anchor aria-hidden=true href=#recommended-10-15-players>#</a></h4><ul><li>Intel Core or AMD K8 based CPU</li><li>3 GB RAM</li><li>16 GB Storage Space</li></ul><h4 id=optimal-20-players><strong>Optimal (20+ Players)</strong><a hidden class=anchor aria-hidden=true href=#optimal-20-players>#</a></h4><ul><li>Intel i5/i7 or AMD Ryzen 5/7 Based CPU</li><li>6 GB RAM</li><li>35 GB Storage Space</li></ul><h2 id=building-the-container><strong>Building the Container</strong><a hidden class=anchor aria-hidden=true href=#building-the-container>#</a></h2><p>Now we have the formalities sorted, we can get to work on creating the
docker container for Minecraft.</p><ol><li><p><strong>Create a directory in which you will keep the Minecraft server files</strong></p><ul><li><code>mkdir minecraft-server</code></li><li><code>cd minecraft-server</code></li></ul></li><li><p><strong>Create an environment file to be used by the Docker Container</strong></p><ul><li>The <em>.env</em> file allows us to specify variables which we can use
across the build process.</li><li><code>touch .env</code></li><li>Edit the file in a text editor, i.e. vim <code>vim .env</code><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl><span class=nv>CONTAINER_NAME</span><span class=o>=</span>minecraft-server
</span></span><span class=line><span class=cl><span class=nv>SERVER_MEM</span><span class=o>=</span><span class=m>4096</span> <span class=c1>#change this to your desired value (in MB)</span>
</span></span><span class=line><span class=cl><span class=nv>SERVER_JAR</span><span class=o>=</span>minecraft_server.1.18.2.jar
</span></span></code></pre></div></li></ul></li><li><p><strong>Create the docker-compose.yml file</strong></p><ul><li>The <em>docker-compose.yml</em> file specifies the container that we
want to build, outlining the build context (Dockerfile),
setting the variables (from .env), configuring storage volumes
for persistence as well as ports and the container name.</li><li><code>touch docker-compose.yml</code></li><li>Edit the file in a text editor<sup id=fnref:3><a href=#fn:3 class=footnote-ref role=doc-noteref>3</a></sup>, I.e. vim <code>vim docker-compose.yml</code><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>version: <span class=s2>&#34;3&#34;</span>
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>services:
</span></span><span class=line><span class=cl> minecraft-server:
</span></span><span class=line><span class=cl> build:
</span></span><span class=line><span class=cl> context: .
</span></span><span class=line><span class=cl> args:
</span></span><span class=line><span class=cl> SERVER_MEM: <span class=si>${</span><span class=nv>SERVER_MEM</span><span class=si>}</span>
</span></span><span class=line><span class=cl> SERVER_JAR: <span class=si>${</span><span class=nv>SERVER_JAR</span><span class=si>}</span>
</span></span><span class=line><span class=cl> volumes:
</span></span><span class=line><span class=cl> - .server-data:/server
</span></span><span class=line><span class=cl> ports:
</span></span><span class=line><span class=cl> - 25565:25565
</span></span><span class=line><span class=cl> - 25575:25575
</span></span><span class=line><span class=cl> container_name: <span class=si>${</span><span class=nv>CONTAINER_NAME</span><span class=si>}</span>
</span></span><span class=line><span class=cl> restart: unless-stopped
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>volumes:
</span></span><span class=line><span class=cl> server-data:
</span></span></code></pre></div></li></ul></li><li><p><strong>Create the Dockerfile file</strong></p><ul><li>The Dockerfile builds the container. We take the 17-jre base
image apply our variables change the working directory to
/server and start the jar file, effectively starting the
Minecraft server.</li><li><code>touch Dockerfile</code></li><li>Edit the file in a text editor, i.e. vim <code>vim Dockerfile</code><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>FROM eclipse-temurin:17-jre
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>ARG SERVER_MEM
</span></span><span class=line><span class=cl>ARG SERVER_JAR
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>ENV <span class=nv>SERVER_MEM</span><span class=o>=</span><span class=si>${</span><span class=nv>SERVER_MEM</span><span class=si>}</span>
</span></span><span class=line><span class=cl>ENV <span class=nv>SERVER_JAR</span><span class=o>=</span><span class=si>${</span><span class=nv>SERVER_JAR</span><span class=si>}</span>
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>WORKDIR /server
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>CMD <span class=nb>echo</span> <span class=s2>&#34;Minecraft Server is starting\n&#34;</span> <span class=o>&amp;&amp;</span> java -Xms128M -Xmx<span class=si>${</span><span class=nv>SERVER_MEM</span><span class=si>}</span>M -jar <span class=si>${</span><span class=nv>SERVER_JAR</span><span class=si>}</span> nogui
</span></span></code></pre></div></li></ul></li></ol><h2 id=setup-the-server-files><strong>Setup the Server files</strong><a hidden class=anchor aria-hidden=true href=#setup-the-server-files>#</a></h2><p>We’re almost there, just a few steps left !!</p><p>The curious among you may have realised when trying to start the
container that it fails with the error below:</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>Minecraft Server is starting
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl>Error: Unable to access jarfile server.jar
</span></span></code></pre></div><p>This is because we have not downloaded the server jar file yet, that is
our next step.</p><ol><li><strong>Navigate to one of the following sites:</strong><sup id=fnref:4><a href=#fn:4 class=footnote-ref role=doc-noteref>4</a></sup><ul><li><a href=https://www.minecraft.net/en-us/download/server target=_blank>Vanilla Minecraft Server</a>
- instructions found here<sup id=fnref:5><a href=#fn:5 class=footnote-ref role=doc-noteref>5</a></sup></li><li><a href=https://fabricmc.net/use/server/ target=_blank>Fabric Mod loader server</a>
- instructions found here <sup id=fnref:6><a href=#fn:6 class=footnote-ref role=doc-noteref>6</a></sup></li></ul></li><li><strong>Create a folder in the Minecraft-server folder called .server-data</strong><ul><li><code>mkdir .server-data</code></li><li><code>cd .server-data</code></li></ul></li><li><strong>Download the jar file - This will depend on the option above so read the instructions</strong></li><li><strong>Go back to the root minecraft-server folder</strong><ul><li><code>cd ..</code></li></ul></li><li><strong>Run the container</strong><ul><li><code>docker compose up</code> (use CTRL+C to exit)</li><li>Once the server unpacks all the files you will see this:<div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>minecraft-server <span class=p>|</span> Starting net.minecraft.server.Main
</span></span><span class=line><span class=cl>minecraft-server <span class=p>|</span> <span class=o>[</span>18:05:50<span class=o>]</span> <span class=o>[</span>ServerMain/INFO<span class=o>]</span>: You need to agree to the EULA in order to run the server. Go to eula.txt <span class=k>for</span> more info.
</span></span><span class=line><span class=cl>minecraft-server exited with code <span class=m>0</span>
</span></span></code></pre></div></li></ul></li><li><strong>Accept the EULA</strong><ul><li>Go into the .server-data folder<ol><li><code>cd .server-data</code></li></ol></li><li>Edit the file named eula.txt in a text editor i.e. vim <code>vim eula.txt</code><ol><li>Simply change <code>eula=false</code> to <code>eula=true</code></li></ol></li></ul></li><li><strong>While in the .server-data folder make any changes you want</strong><ul><li>Some files to note in here are<ul><li><strong>server.properties</strong> - properties like server name, game mode, world type etc…</li><li><strong>ops.json</strong> - list of server operators (easier to set ingame)</li><li><strong>whitelist.json</strong> - list of players allowed to join the server everyone else rejected access.</li></ul></li></ul></li><li><strong>Run the container</strong><ul><li><code>docker compose up -d</code> (the -d means detatched so we can run the server in the background)</li><li><code>docker logs minecraft-server --follow</code> Will show us the progress of the server startup (to exit out of this do CTRL+C)</li><li>If you see something like the following then you’re a winner 🥳<div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl><span class=o>[</span>18:17:01<span class=o>]</span> <span class=o>[</span>Server thread/INFO<span class=o>]</span>: Time elapsed: <span class=m>25529</span> ms
</span></span><span class=line><span class=cl><span class=o>[</span>18:17:01<span class=o>]</span> <span class=o>[</span>Server thread/INFO<span class=o>]</span>: Done <span class=o>(</span>34.571s<span class=o>)</span>! For help, <span class=nb>type</span> <span class=s2>&#34;help&#34;</span>
</span></span></code></pre></div></li></ul></li></ol><h2 id=conclusion>Conclusion<a hidden class=anchor aria-hidden=true href=#conclusion>#</a></h2><p>Well done you have successfully setup a Minecraft server, now go play !!
There is a lot of cool stuff you can do with a Minecraft server for
example installing mods or creating scripts to manage the server, this
will be covered in the next post so keep an eye out for it !!</p><div class=footnotes role=doc-endnotes><hr><ol><li id=fn:1><p>Hosting your own dedicated server allows you to modify every aspect of the server as you see fit. I.E you can modify the server-properties, you can implement a whitelist not to mention being able to add any mods you want&#160;<a href=#fnref:1 class=footnote-backref role=doc-backlink>&#8617;&#xfe0e;</a></p></li><li id=fn:2><p>Requirements Gathered from here <a href=https://minecraft.fandom.com/wiki/Server/Requirements/Dedicated#Unix_.28Linux.2C_BSD.2C_macOS.29 target=_blank>https://minecraft.fandom.com/wiki/Server/Requirements/Dedicated#Unix_.28Linux.2C_BSD.2C_macOS.29</a>
&#160;<a href=#fnref:2 class=footnote-backref role=doc-backlink>&#8617;&#xfe0e;</a></p></li><li id=fn:3><p>Yaml is very picky 😞 when it comes to formatting so if you encounter any errors double check your formatting !!&#160;<a href=#fnref:3 class=footnote-backref role=doc-backlink>&#8617;&#xfe0e;</a></p></li><li id=fn:4><p>I have left Forge out as it is a more involved process plus Fabric is better 😜&#160;<a href=#fnref:4 class=footnote-backref role=doc-backlink>&#8617;&#xfe0e;</a></p></li><li id=fn:5><p>Right click the green link that says something like minecraft_server.x.xx.x.jar and copy the link address</p><p>curl -o server.jar &lt;link you copied here>&#160;<a href=#fnref:5 class=footnote-backref role=doc-backlink>&#8617;&#xfe0e;</a></p></li><li id=fn:6><p>Select the Minecraft version, Fabric Loader Version and the Installer Version of your choice. I tend to go with the latest.</p><p>Copy the curl command under CLI download&#160;<a href=#fnref:6 class=footnote-backref role=doc-backlink>&#8617;&#xfe0e;</a></p></li></ol></div></div><footer class=post-footer><ul class=post-tags><li><a href=https://blog.ahmza.com/tags/games/>Games</a></li><li><a href=https://blog.ahmza.com/tags/docker/>Docker</a></li><li><a href=https://blog.ahmza.com/tags/arm/>ARM</a></li></ul></footer></article></main><footer class=footer><span>&copy; 2023 <a href=https://blog.ahmza.com>ahmza's ramblings</a></span>
<span>Powered by
<a href=https://gohugo.io/ rel="noopener noreferrer" target=_blank>Hugo</a> &
<a href=https://github.com/adityatelange/hugo-PaperMod/ rel=noopener target=_blank>PaperMod</a></span></footer><a href=#top aria-label="go to top" title="Go to Top (Alt + G)" class=top-link id=top-link accesskey=g><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentcolor"><path d="M12 6H0l6-6z"/></svg></a><script src=https://storage.ko-fi.com/cdn/scripts/overlay-widget.js></script><script>kofiWidgetOverlay.draw("ahmza",{type:"floating-chat","floating-chat.donateButton.text":"Tip","floating-chat.donateButton.background-color":"rgb(145, 70, 255)","floating-chat.donateButton.text-color":"#fff"})</script><script>let menu=document.getElementById("menu");menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(e=>{e.addEventListener("click",function(e){e.preventDefault();var t=this.getAttribute("href").substr(1);window.matchMedia("(prefers-reduced-motion: reduce)").matches?document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView({behavior:"smooth"}),t==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${t}`)})})</script><script>var mybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script><script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove("dark"),localStorage.setItem("pref-theme","light")):(document.body.classList.add("dark"),localStorage.setItem("pref-theme","dark"))})</script><script>document.querySelectorAll("pre > code").forEach(e=>{const n=e.parentNode.parentNode,t=document.createElement("button");t.classList.add("copy-code"),t.innerHTML="copy";function s(){t.innerHTML="copied!",setTimeout(()=>{t.innerHTML="copy"},2e3)}t.addEventListener("click",t=>{if("clipboard"in navigator){navigator.clipboard.writeText(e.textContent),s();return}const n=document.createRange();n.selectNodeContents(e);const o=window.getSelection();o.removeAllRanges(),o.addRange(n);try{document.execCommand("copy"),s()}catch{}o.removeRange(n)}),n.classList.contains("highlight")?n.appendChild(t):n.parentNode.firstChild==n||(e.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName=="TABLE"?e.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(t):e.parentNode.appendChild(t))})</script></body></html>