mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 07:03:57 +00:00
Add pull policy to examples in docs (#3739)
This commit is contained in:
@@ -19,7 +19,7 @@ If you want to use a file's content for value, such as when using secrets mounte
|
||||
|
||||
For example, a `my.cnf` file could contain:
|
||||
|
||||
```
|
||||
```toml
|
||||
[client]
|
||||
password = ${CFG_DB_PASSWORD}
|
||||
```
|
||||
@@ -50,8 +50,7 @@ REPLACE_ENV_VARIABLES_EXCLUDE_PATHS="/data/plugins/Essentials/userdata /data/plu
|
||||
|
||||
Here is a full example where we want to replace values inside a `database.yml`.
|
||||
|
||||
```yml
|
||||
|
||||
```yaml
|
||||
---
|
||||
database:
|
||||
host: ${CFG_DB_HOST}
|
||||
@@ -59,10 +58,10 @@ database:
|
||||
password: ${CFG_DB_PASSWORD}
|
||||
```
|
||||
|
||||
This is how your `docker-compose.yml` file could look like:
|
||||
This is how your `compose.yaml` file could look like:
|
||||
|
||||
```yml
|
||||
# Other docker-compose examples in /examples
|
||||
```yaml title="compose.yaml"
|
||||
# Other docker compose examples in /examples
|
||||
|
||||
services:
|
||||
minecraft:
|
||||
|
||||
@@ -13,10 +13,11 @@ For VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, CURSEFORGE, SPONGEVANILLA server type
|
||||
`$FORCE_REDOWNLOAD` to some value (e.g. 'true) to force a re-download of the server file for
|
||||
the particular server type. by adding a `-e FORCE_REDOWNLOAD=true` to your command-line.
|
||||
|
||||
For example, with PaperSpigot, it would look something like this:
|
||||
For example, with Paper, it would look something like this:
|
||||
|
||||
```
|
||||
docker run -d -v /path/on/host:/data \
|
||||
docker run -d --pull=always \
|
||||
-v /path/on/host:/data \
|
||||
-e TYPE=PAPER -e FORCE_REDOWNLOAD=true \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
```
|
||||
@@ -47,7 +48,7 @@ To allow time for players to finish what they're doing during a graceful server
|
||||
|
||||
The Docker stop grace period must be increased to a value longer than the announce delay. The value to use that is longer than announce delay will vary based upon the amount of time it takes for final world data saving. If the container exits with exit code 137, then that indicates a longer grace period is needed.
|
||||
|
||||
The grace period can be increased using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/) or set the [stop_grace_period](https://docs.docker.com/compose/compose-file/05-services/#stop_grace_period) in the compose file.
|
||||
The grace period can be increased using [the -t option on `docker compose down`](https://docs.docker.com/compose/reference/down/) or set the [stop_grace_period](https://docs.docker.com/compose/compose-file/05-services/#stop_grace_period) in the compose file.
|
||||
|
||||
The `STOP_SERVER_ANNOUNCE_DELAY` can be bypassed by sending a `SIGUSR1` signal to the `mc-server-runner` process.
|
||||
|
||||
@@ -94,7 +95,7 @@ You can configure the timezone to match yours by setting the `TZ` environment va
|
||||
|
||||
such as:
|
||||
|
||||
docker run -d -it -e TZ=Europe/London -p 25565:25565 --name mc itzg/minecraft-server
|
||||
docker run -d -it --pull=always -e TZ=Europe/London -p 25565:25565 --name mc itzg/minecraft-server
|
||||
|
||||
Or mounting `/etc/timezone` as readonly (not supported on Windows):
|
||||
|
||||
@@ -102,7 +103,7 @@ Or mounting `/etc/timezone` as readonly (not supported on Windows):
|
||||
|
||||
such as:
|
||||
|
||||
docker run -d -it -v /etc/timezone:/etc/timezone:ro -p 25565:25565 --name mc itzg/minecraft-server
|
||||
docker run -d -it --pull=always -v /etc/timezone:/etc/timezone:ro -p 25565:25565 --name mc itzg/minecraft-server
|
||||
|
||||
## HTTP Proxy
|
||||
|
||||
|
||||
@@ -28,13 +28,14 @@ When attached in this way you can stop the server, edit the configuration under
|
||||
|
||||
There might be a safer/better way to accommodate these systems. Please post an issue or PR if you have more information.
|
||||
|
||||
With Docker Compose, setting up a host attached directory is even easier since relative paths can be configured. For example, with the following `docker-compose.yml` Docker will automatically create/attach the relative directory `minecraft-data` to the container.
|
||||
With Docker Compose, setting up a host attached directory is even easier since relative paths can be configured. For example, with the following `compose.yaml` Docker will automatically create/attach the relative directory `minecraft-data` to the container.
|
||||
|
||||
``` yaml title="docker-compose.yml"
|
||||
```yaml title="compose.yaml"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
image: itzg/minecraft-server:latest
|
||||
pull_policy: daily
|
||||
ports:
|
||||
- 25565:25565
|
||||
environment:
|
||||
|
||||
@@ -13,7 +13,7 @@ latest snapshot. See the _Versions_ section below for more information.
|
||||
|
||||
To simply use the latest stable version, run
|
||||
|
||||
docker run -d -it -p 25565:25565 -e EULA=TRUE itzg/minecraft-server
|
||||
docker run -d -it --pull=always -p 25565:25565 -e EULA=TRUE itzg/minecraft-server
|
||||
|
||||
where, in this case, the standard server port 25565, will be exposed on your host machine.
|
||||
|
||||
@@ -34,15 +34,16 @@ By default, the container will download the latest version of the "vanilla" [Min
|
||||
## Using [Docker Compose](https://docs.docker.com/compose/)
|
||||
|
||||
1. Create a new directory
|
||||
2. Put the contents of the file below in a file called `docker-compose.yml`
|
||||
2. Put the contents of the file below in a file called `compose.yaml`
|
||||
3. Run `docker compose up -d` in that directory
|
||||
4. Done! Point your client at your host's name/IP address and port 25565.
|
||||
|
||||
```yaml
|
||||
```yaml title="compose.yaml"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
image: itzg/minecraft-server:latest
|
||||
pull_policy: daily
|
||||
tty: true
|
||||
stdin_open: true
|
||||
ports:
|
||||
@@ -59,7 +60,7 @@ To apply changes made to the compose file, just run `docker compose up -d` again
|
||||
Follow the logs of the container using `docker compose logs -f`, check on the status with `docker compose ps`, and stop the container using `docker compose stop`.
|
||||
|
||||
!!! note "Configurator Tool"
|
||||
If you prefer to use an interactive tool to create or edit a Docker Compose file for this image, you can check out [setupmc.com's configurator](https://setupmc.com/java-server/). It provides a form that supports most of the image variables and generates the `compose.yml` file in real time.
|
||||
If you prefer to use an interactive tool to create or edit a Docker Compose file for this image, you can check out [setupmc.com's configurator](https://setupmc.com/java-server/). It provides a form that supports most of the image variables and generates the `compose.yaml` file in real time.
|
||||
|
||||
!!! note "More Compose Examples"
|
||||
There are more [examples located in the Github repo](https://github.com/itzg/docker-minecraft-server/tree/master/examples).
|
||||
|
||||
@@ -21,8 +21,8 @@ $env:FOLDER_TO_TEST="forgeapimods_projectids"
|
||||
$env:IMAGE_TO_TEST="mc-dev"
|
||||
docker build -t $env:IMAGE_TO_TEST .
|
||||
pushd "tests/setuponlytests/$env:FOLDER_TO_TEST/"
|
||||
docker-compose run mc
|
||||
docker-compose down -v --remove-orphans
|
||||
docker compose run mc
|
||||
docker compose down -v --remove-orphans
|
||||
popd
|
||||
```
|
||||
|
||||
@@ -39,8 +39,8 @@ export FOLDER_TO_TEST="forgeapimods_file"
|
||||
export IMAGE_TO_TEST="mc-dev"
|
||||
docker build -t $IMAGE_TO_TEST .
|
||||
pushd tests/setuponlytests/$FOLDER_TO_TEST/
|
||||
docker-compose run mc
|
||||
docker-compose down -v --remove-orphans
|
||||
docker compose run mc
|
||||
docker compose down -v --remove-orphans
|
||||
popd
|
||||
```
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ Various examples are [maintained in the repository](https://github.com/itzg/dock
|
||||
|
||||
Using the [GeyserMC plugin](https://geysermc.org/) with a Paper server (or similar) "enables clients from Minecraft Bedrock Edition to join your Minecraft Java server". The example also includes [Floodgate](https://wiki.geysermc.org/floodgate/) which "allows Xbox Live authenticated Bedrock users to join without a Java Edition account".
|
||||
|
||||
```yaml
|
||||
```yaml title="compose.yaml"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
image: itzg/minecraft-server:latest
|
||||
pull_policy: daily
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: "PAPER"
|
||||
@@ -30,7 +31,7 @@ services:
|
||||
|
||||
With [lazymc-docker-proxy](https://github.com/joesturge/lazymc-docker-proxy) you are able to use [lazymc](https://github.com/timvisee/lazymc) with the minecraft container.
|
||||
|
||||
```yaml
|
||||
```yaml title="compose.yaml"
|
||||
# Lazymc requires that the minecraft server have a static IP.
|
||||
#
|
||||
# To ensure that our servers have a static IP we need to create
|
||||
@@ -72,6 +73,7 @@ services:
|
||||
# Standard Docker Minecraft server, also works with other server types
|
||||
mc:
|
||||
image: itzg/minecraft-server:java21
|
||||
pull_policy: daily
|
||||
# Assign a static IP to the server container
|
||||
networks:
|
||||
minecraft-network:
|
||||
@@ -105,7 +107,7 @@ Monitors network traffic to the Minecraft containers. If there is traffic, the c
|
||||
|
||||
By using [Lazytainer](https://github.com/vmorganp/Lazytainer) with the [docker-minecraft-server](https://github.com/itzg/docker-minecraft-server) a somehow similar behaviour to [Lazymc](https://github.com/timvisee/lazymc) can be archived.
|
||||
|
||||
```yaml
|
||||
```yaml title="compose.yaml"
|
||||
services:
|
||||
lazytainer:
|
||||
image: ghcr.io/vmorganp/lazytainer:master
|
||||
@@ -123,7 +125,8 @@ services:
|
||||
restart: unless-stopped
|
||||
network_mode: bridge
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
image: itzg/minecraft-server:latest
|
||||
pull_policy: daily
|
||||
environment:
|
||||
EULA: TRUE
|
||||
TYPE: PAPER
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
To configure server mods using a packwiz modpack, set the `PACKWIZ_URL` environment variable to the location of your `pack.toml` modpack definition:
|
||||
|
||||
```
|
||||
docker run -d -v /path/on/host:/data -e TYPE=FABRIC \
|
||||
docker run -d --pull=always \
|
||||
-v /path/on/host:/data -e TYPE=FABRIC \
|
||||
-e "PACKWIZ_URL=https://example.com/modpack/pack.toml" \
|
||||
itzg/minecraft-server
|
||||
```
|
||||
|
||||
@@ -11,8 +11,7 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
|
||||
When entering your API Key in a docker compose file you will need to escape any `$` character with a second `$`. Refer to [this compose file reference section](https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution) for more information.
|
||||
|
||||
Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`:
|
||||
```yaml
|
||||
# compose.yaml
|
||||
```yaml title="compose.yaml"
|
||||
environment:
|
||||
CF_API_KEY: '$$11$$22$$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
```
|
||||
@@ -24,15 +23,13 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
|
||||
|
||||
To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). You **do not** need to escape `$`'s with a second `$` in the `.env` file **as long as the key is wrapped in single quotes**.
|
||||
|
||||
```
|
||||
# .env
|
||||
```title=".env"
|
||||
CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
```
|
||||
|
||||
The variable should to be referenced from the compose file, such as:
|
||||
|
||||
```yaml
|
||||
# compose.yaml
|
||||
```yaml title="compose.yaml"
|
||||
environment:
|
||||
CF_API_KEY: ${CF_API_KEY}
|
||||
```
|
||||
@@ -40,19 +37,19 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
|
||||
The .env file should be placed in the same directory as your compose file like so:
|
||||
|
||||
```
|
||||
/minecraft-server
|
||||
minecraft-server/
|
||||
├── .env
|
||||
├── compose.yaml
|
||||
├── /data
|
||||
├── data/
|
||||
```
|
||||
|
||||
To use the equivalent with `docker run` you need to specify the `.env` file explicitly:
|
||||
```
|
||||
```shell
|
||||
docker run --env-file=.env itzg/minecraft-server
|
||||
```
|
||||
|
||||
Alternately you can use [docker secrets](https://docs.docker.com/compose/how-tos/use-secrets/) with a `CF_API_KEY_FILE` environment variable:
|
||||
```
|
||||
```yaml title="compose.yaml"
|
||||
service:
|
||||
environment:
|
||||
CF_API_KEY_FILE: /run/secrets/cf_api_key
|
||||
@@ -131,7 +128,7 @@ For mod, modpacks, and world files that are not allowed for automated download,
|
||||
|
||||
Assuming Docker compose is being used:
|
||||
|
||||
1. Create a directory next to the `docker-compose.yml` file. The name doesn't matter, but "downloads" is the common convention
|
||||
1. Create a directory next to the `compose.yaml` file. The name doesn't matter, but "downloads" is the common convention
|
||||
2. From the "Mods Need Download" output, visit the download page of each, click on the file download and save that file into the directory created in the previous step
|
||||
3. Add a host directory mount to the volumes section where the container path **must be** `/downloads`. The snippet below shows how that will look
|
||||
4. Re-run `docker compose up -d` to apply the changes
|
||||
@@ -150,7 +147,8 @@ If you wish to use an unpublished modpack zip, set the container path to the fil
|
||||
```yaml
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
image: itzg/minecraft-server:latest
|
||||
pull_policy: daily
|
||||
environment:
|
||||
EULA: true
|
||||
MODPACK_PLATFORM: AUTO_CURSEFORGE
|
||||
|
||||
@@ -11,20 +11,20 @@ variable. A CurseForge server modpack is available together with its respective
|
||||
client modpack at <https://www.curseforge.com/minecraft/modpacks> .
|
||||
|
||||
Now you can add a `-e CF_SERVER_MOD=name_of_modpack.zip` to your command-line.
|
||||
|
||||
docker run -d -v /path/on/host:/data -e TYPE=CURSEFORGE \
|
||||
-e CF_SERVER_MOD=SkyFactory_4_Server_4.1.0.zip \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
|
||||
```shell
|
||||
docker run -d --pull=always -v /path/on/host:/data -e TYPE=CURSEFORGE \
|
||||
-e CF_SERVER_MOD=SkyFactory_4_Server_4.1.0.zip \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
```
|
||||
If you want to keep the pre-download modpacks separate from your data directory,
|
||||
then you can attach another volume at a path of your choosing and reference that.
|
||||
The following example uses `/modpacks` as the container path as the pre-download area:
|
||||
|
||||
docker run -d -v /path/on/host:/data -v /path/to/modpacks:/modpacks \
|
||||
-e TYPE=CURSEFORGE \
|
||||
-e CF_SERVER_MOD=/modpacks/SkyFactory_4_Server_4.1.0.zip \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
|
||||
```shell
|
||||
docker run -d --pull=always -v /path/on/host:/data \
|
||||
-v /path/to/modpacks:/modpacks -e TYPE=CURSEFORGE \
|
||||
-e CF_SERVER_MOD=/modpacks/SkyFactory_4_Server_4.1.0.zip \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
```
|
||||
### Modpack data directory
|
||||
|
||||
By default, CurseForge modpacks are expanded into the sub-directory `/data/FeedTheBeast` and executed from there. (The default location was chosen for legacy reasons, when Curse and FTB were maintained together.)
|
||||
|
||||
@@ -30,12 +30,8 @@ If a specific `FTB_MODPACK_VERSION_ID` was not specified, simply restart the con
|
||||
The following example runs the latest version of [FTB Presents Direwolf20 1.12](https://ftb.neptunepowered.org/pack/ftb-presents-direwolf20-1-12/):
|
||||
|
||||
``` shell
|
||||
docker run -d --name mc-ftb -e EULA=TRUE \
|
||||
-e TYPE=FTBA -e FTB_MODPACK_ID=31 \
|
||||
-p 25565:25565 \
|
||||
itzg/minecraft-server:java8-multiarch
|
||||
docker run -d --pull=always -v /path/on/host:/data \
|
||||
-e EULA=TRUE -e TYPE=FTBA \
|
||||
-e FTB_MODPACK_ID=31 -p 25565:25565 \
|
||||
itzg/minecraft-server:java8-multiarch
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
Normally you will also add `-v` volume for `/data` since the mods and config are installed there along with world data.
|
||||
|
||||
@@ -4,8 +4,8 @@ A [Fabric server](https://fabricmc.net/) can be automatically downloaded, upgrad
|
||||
|
||||
Using `docker run` command line
|
||||
|
||||
```
|
||||
docker run -d -e EULA=TRUE -e TYPE=FABRIC -p 25565:25565 itzg/minecraft-server
|
||||
```shell
|
||||
docker run -d --pull=always -e EULA=TRUE -e TYPE=FABRIC -p 25565:25565 itzg/minecraft-server
|
||||
```
|
||||
|
||||
In a compose file service:
|
||||
@@ -24,7 +24,7 @@ A specific loader or launcher version other than the latest can be requested usi
|
||||
|
||||
With docker run
|
||||
|
||||
```
|
||||
```shell
|
||||
docker run -d ... \
|
||||
-e TYPE=FABRIC \
|
||||
-e FABRIC_LAUNCHER_VERSION=0.10.2 \
|
||||
|
||||
@@ -10,7 +10,7 @@ A [Forge server](http://www.minecraftforge.net/) can be automatically downloaded
|
||||
|
||||
!!! example
|
||||
|
||||
```
|
||||
```shell
|
||||
docker run -e TYPE=FORGE ...
|
||||
```
|
||||
|
||||
@@ -25,7 +25,7 @@ The overall version is specified by `VERSION`, [as described in the section abov
|
||||
|
||||
!!! example
|
||||
|
||||
```
|
||||
```shell
|
||||
docker run -e TYPE=FORGE -e VERSION=1.12.2 -e FORGE_VERSION=14.23.5.2854 ...
|
||||
```
|
||||
|
||||
@@ -58,7 +58,7 @@ Support for [NeoForge](https://neoforged.net/) is also provided. A NeoForge serv
|
||||
|
||||
!!! example
|
||||
|
||||
```
|
||||
```shell
|
||||
docker run -e TYPE=NEOFORGE -e VERSION=1.20.1 -e NEOFORGE_VERSION=47.1.79 ...
|
||||
```
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ If you want to run a specific version, you can add `-e SPONGEVERSION=1.11.2-6.1.
|
||||
Beware that current [Sponge](https://www.spongepowered.org) `STABLE` versions for Minecraft 1.12 require using [the Java 8 tag](../../versions/java.md):
|
||||
|
||||
``` shell
|
||||
docker run -d -v /path/on/host:/data -e TYPE=SPONGEVANILLA \
|
||||
docker run -d --pull=always -v /path/on/host:/data -e TYPE=SPONGEVANILLA \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server:java8-multiarch
|
||||
```
|
||||
|
||||
@@ -17,7 +17,7 @@ You can also choose to use the `EXPERIMENTAL` branch.
|
||||
Just change it with `SPONGEBRANCH`, such as:
|
||||
|
||||
``` shell
|
||||
$ docker run -d -v /path/on/host:/data ... \
|
||||
$ docker run -d --pull=always -v /path/on/host:/data ... \
|
||||
-e TYPE=SPONGEVANILLA -e SPONGEBRANCH=EXPERIMENTAL ...
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ To allow for the selection of experimental builds, set `PAPER_CHANNEL` to "exper
|
||||
|
||||
Using `docker run` command line
|
||||
|
||||
```
|
||||
```shell
|
||||
docker run ... -e TYPE=PAPER ...
|
||||
|
||||
docker run ... -e TYPE=PAPER -e VERSION=1.20.6 ...
|
||||
@@ -112,9 +112,9 @@ By default, the container will run the latest experimental build of [Folia serve
|
||||
|
||||
Using `docker run`
|
||||
|
||||
```
|
||||
docker run -d -v /path/on/host:/data \
|
||||
-e TYPE=FOLIA \
|
||||
```shell
|
||||
docker run -d --pull=always \
|
||||
-v /path/on/host:/data -e TYPE=FOLIA \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
```
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Enable [Quilt server](https://quiltmc.org/) mode by adding a `-e TYPE=QUILT` to your command-line.
|
||||
|
||||
```
|
||||
docker run -d -v /path/on/host:/data \
|
||||
-e TYPE=QUILT \
|
||||
```shell
|
||||
docker run -d --pull=always \
|
||||
-v /path/on/host:/data -e TYPE=QUILT \
|
||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||
```
|
||||
|
||||
@@ -10,9 +10,9 @@ By default, the container will install the latest [quilt server launcher](https:
|
||||
|
||||
A specific loader or installer version other than the latest can be requested using `QUILT_LOADER_VERSION` and `QUILT_INSTALLER_VERSION` respectively, such as:
|
||||
|
||||
```
|
||||
docker run -d -v /path/on/host:/data ... \
|
||||
-e TYPE=QUILT \
|
||||
```shell
|
||||
docker run -d --pull=always \
|
||||
-v /path/on/host:/data ... -e TYPE=QUILT \
|
||||
-e QUILT_LOADER_VERSION=0.16.0 \
|
||||
-e QUILT_INSTALLER_VERSION=0.4.1
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user