Compare commits

...

10 Commits

Author SHA1 Message Date
Geoff Bourne
33435b7e52 Generalize EULA instructions in error 2025-03-21 16:06:05 -05:00
Geoff Bourne
231ac0f665 Add Docker logo to badges (#3375) 2025-03-19 20:52:46 -05:00
Geoff Bourne
68a56be107 Fix SKIP_CHOWN_DATA (#3374) 2025-03-19 19:43:26 -05:00
dependabot[bot]
ac32c8706f build(deps): bump the updates group across 1 directory with 5 updates (#3369) 2025-03-17 20:27:49 -05:00
Geoff Bourne
f5e511e3cc docs: clarify that ICON can be a container path (#3371) 2025-03-17 09:41:21 -05:00
dependabot[bot]
2a859d61f6 build(deps): bump mkdocs-material from 9.6.7 to 9.6.8 in /docs in the patches group (#3370) 2025-03-17 07:36:02 -05:00
dependabot[bot]
943429e180 build(deps): bump the patches group across 1 directory with 3 updates (#3355)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
2025-03-16 14:23:03 -05:00
Geoff Bourne
7e5f5805a5 Add AUTOPAUSE_STATUS_RETRY_LIMIT and AUTOPAUSE_STATUS_RETRY_INTERVAL (#3365) 2025-03-16 13:25:37 -05:00
joesturge
777f4e26b9 Lazymc - Update misc examples with non-deprecated method of managing lazymc (#3360) 2025-03-15 18:44:23 -05:00
Henry
21f2a7e86c Exclude compass-coords globally from cf and mr, client side mod (#3361) 2025-03-15 10:07:12 -05:00
15 changed files with 129 additions and 45 deletions

View File

@@ -111,7 +111,7 @@ jobs:
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v5.6.1 uses: docker/metadata-action@v5.7.0
with: with:
# NOTE for forks: if your Docker Hub organization doesn't match your Github repo's, # NOTE for forks: if your Docker Hub organization doesn't match your Github repo's,
# then the use of ${{ github.repository_owner }} will need to be replaced. # then the use of ${{ github.repository_owner }} will need to be replaced.
@@ -139,13 +139,13 @@ jobs:
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com> org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.9.0 uses: docker/setup-buildx-action@v3.10.0
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3.4.0 uses: docker/setup-qemu-action@v3.6.0
- name: Build for test - name: Build for test
uses: docker/build-push-action@v6.14.0 uses: docker/build-push-action@v6.15.0
with: with:
platforms: linux/amd64 platforms: linux/amd64
tags: ${{ env.IMAGE_TO_TEST }} tags: ${{ env.IMAGE_TO_TEST }}
@@ -168,14 +168,14 @@ jobs:
tests/test.sh tests/test.sh
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.4.0
if: env.HAS_IMAGE_REPO_ACCESS if: env.HAS_IMAGE_REPO_ACCESS
with: with:
username: ${{ secrets.DOCKER_USER }} username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.4.0
if: env.HAS_IMAGE_REPO_ACCESS if: env.HAS_IMAGE_REPO_ACCESS
with: with:
registry: ghcr.io registry: ghcr.io
@@ -183,7 +183,7 @@ jobs:
password: ${{ github.token }} password: ${{ github.token }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v6.14.0 uses: docker/build-push-action@v6.15.0
if: github.actor == github.repository_owner if: github.actor == github.repository_owner
with: with:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}

View File

@@ -53,10 +53,10 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.9.0 uses: docker/setup-buildx-action@v3.10.0
- name: Confirm multi-arch build - name: Confirm multi-arch build
uses: docker/build-push-action@v6.14.0 uses: docker/build-push-action@v6.15.0
with: with:
platforms: ${{ matrix.platforms }} platforms: ${{ matrix.platforms }}
# ensure latest base image is used # ensure latest base image is used
@@ -66,7 +66,7 @@ jobs:
cache-from: type=gha,scope=${{ matrix.variant }} cache-from: type=gha,scope=${{ matrix.variant }}
- name: Build for test - name: Build for test
uses: docker/build-push-action@v6.14.0 uses: docker/build-push-action@v6.15.0
with: with:
# Only build single platform since loading multi-arch image into daemon fails with # Only build single platform since loading multi-arch image into daemon fails with
# "docker exporter does not currently support exporting manifest lists" # "docker exporter does not currently support exporting manifest lists"

View File

@@ -1,5 +1,5 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg?logo=docker)](https://hub.docker.com/r/itzg/minecraft-server/)
[![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?logo=docker)](https://hub.docker.com/r/itzg/minecraft-server/)
[![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues) [![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues)
[![Discord](https://img.shields.io/discord/660567679458869252?label=Discord&logo=discord)](https://discord.gg/DXfKpjB) [![Discord](https://img.shields.io/discord/660567679458869252?label=Discord&logo=discord)](https://discord.gg/DXfKpjB)
[![Build and Publish](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml) [![Build and Publish](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml)

View File

@@ -197,14 +197,34 @@ New to [22W42A](https://www.minecraft.net/en-us/article/minecraft-snapshot-22w42
### Server icon ### Server icon
A server icon can be configured using the `ICON` variable. The image will be automatically A server icon can be configured by setting the `ICON` variable to a URL to download or a container path. The image will be automatically downloaded (if a URL), scaled, and converted from any other image format:
downloaded, scaled, and converted from any other image format:
!!! example
Using `docker run`:
```
docker run -d -e ICON=http://..../some/image.png ... docker run -d -e ICON=http://..../some/image.png ...
```
In compose file:
```yaml
environment:
ICON: http://..../some/image.png
```
Using a file from host filesystem:
```yaml
environment:
ICON: /icon.png
OVERRIDE_ICON: true
volumes:
./icon.png:/icon.png
```
The server icon which has been set doesn't get overridden by default. It can be changed and overridden by setting `OVERRIDE_ICON` to `TRUE`. By default an existing `server-icon.png` file will not be replaced, that can be changed by setting `OVERRIDE_ICON` to "true".
docker run -d -e ICON=http://..../some/other/image.png -e OVERRIDE_ICON=TRUE...
### RCON ### RCON
@@ -502,4 +522,4 @@ When using `docker run` from a bash shell, the entries must be quoted with the `
| LOG_IPS | log-ips | | LOG_IPS | log-ips |
| REGION_FILE_COMPRESSION | region-file-compression | | REGION_FILE_COMPRESSION | region-file-compression |
| BUG_REPORT_LINK | bug-report-link | | BUG_REPORT_LINK | bug-report-link |
| PAUSE_WHEN_EMPTY_SECONDS | pause-when-empty-seconds | | PAUSE_WHEN_EMPTY_SECONDS | pause-when-empty-seconds |

View File

@@ -38,6 +38,8 @@ The following environment variables define the behaviour of auto-pausing:
describes period of the daemonized state machine, that handles the pausing of the process (resuming is done independently) describes period of the daemonized state machine, that handles the pausing of the process (resuming is done independently)
- `AUTOPAUSE_KNOCK_INTERFACE`, default `eth0` - `AUTOPAUSE_KNOCK_INTERFACE`, default `eth0`
<br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results. <br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results.
- `AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10
- `AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s
!!! tip !!! tip

View File

@@ -17,12 +17,14 @@ Enable the Autostop functionality by setting:
``` ```
The following environment variables define the behavior of auto-stopping: The following environment variables define the behavior of auto-stopping:
* `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds) - `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds)
describes the time between the last client disconnect and the stopping of the server (read as timeout established) describes the time between the last client disconnect and the stopping of the server (read as timeout established)
* `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds) - `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds)
describes the time between server start and the stopping of the server, when no client connects in-between (read as timeout initialized) describes the time between server start and the stopping of the server, when no client connects in-between (read as timeout initialized)
* `AUTOSTOP_PERIOD`, default `10` (seconds) - `AUTOSTOP_PERIOD`, default `10` (seconds)
describes period of the daemonized state machine, that handles the stopping of the server describes period of the daemonized state machine, that handles the stopping of the server
- `AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10
- `AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s
> To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output > To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output

View File

@@ -31,15 +31,33 @@ 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. 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
# Lazymc requires that the minecraft server have a static IP.
#
# To ensure that our servers have a static IP we need to create
# a network for our services to use.
#
# By default, Docker uses 172.17.0.0/16 subnet range.
# So we need to create a new network in a different subnet
# See the readme for more information.
#
# Please ensure that the subnet falls within the private CIDRs:
# https://datatracker.ietf.org/doc/html/rfc1918#section-3
#
# And that it is not in use by anything else.
networks:
minecraft-network:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16
services: services:
lazymc: lazymc:
container_name: lazymc
image: ghcr.io/joesturge/lazymc-docker-proxy:latest image: ghcr.io/joesturge/lazymc-docker-proxy:latest
environment: # the IPs should start at .2 as .1 is reserved for the gateway
# Point to the service name of the Minecraft server networks:
SERVER_ADDRESS: mc:25565 minecraft-network:
# Required to find the container to manage it ipv4_address: 172.18.0.2
LAZYMC_GROUP: mc
restart: unless-stopped restart: unless-stopped
volumes: volumes:
# you should mount the minecraft server dir under /server, using read only. # you should mount the minecraft server dir under /server, using read only.
@@ -54,11 +72,19 @@ services:
# Standard Docker Minecraft server, also works with other server types # Standard Docker Minecraft server, also works with other server types
mc: mc:
image: itzg/minecraft-server:java21 image: itzg/minecraft-server:java21
container_name: minecraft-server # Assign a static IP to the server container
networks:
minecraft-network:
ipv4_address: 172.18.0.3
# We need to add a label here so that lazymc-docker-proxy knows which # We need to add a label here so that lazymc-docker-proxy knows which
# container to manage # container to manage
labels: labels:
# Set lazymc.enabled to true to enable lazymc on this container
- lazymc.enabled=true
# Required to find the container to manage it
- lazymc.group=mc - lazymc.group=mc
# Point to the service name of the Minecraft server
- lazymc.server.address=mc:25565
tty: true tty: true
stdin_open: true stdin_open: true
# This container should be managed solely by the lazymc container # This container should be managed solely by the lazymc container
@@ -113,4 +139,4 @@ services:
stdin_open: true stdin_open: true
restart: unless-stopped restart: unless-stopped
``` ```
[Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/lazytainer/docker-compose.yml) [Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/lazytainer/docker-compose.yml)

View File

@@ -1,6 +1,6 @@
mkdocs-material == 9.6.1 mkdocs-material == 9.6.8
mkdocs-autorefs == 1.3.0 mkdocs-autorefs == 1.4.1
mkdocstrings == 0.27.0 mkdocstrings[python] == 0.29.0
mkdocs-literate-nav == 0.6.1 mkdocs-literate-nav == 0.6.1
mdx-gh-links == 0.4 mdx-gh-links == 0.4
mkdocs-click == 0.8.1 mkdocs-click == 0.8.1

View File

@@ -13,6 +13,7 @@ services:
# More aggressive settings for demo purposes # More aggressive settings for demo purposes
AUTOPAUSE_TIMEOUT_INIT: "30" AUTOPAUSE_TIMEOUT_INIT: "30"
AUTOPAUSE_TIMEOUT_EST: "10" AUTOPAUSE_TIMEOUT_EST: "10"
JVM_DD_OPTS: "disable.watchdog:true"
restart: unless-stopped restart: unless-stopped
volumes: volumes:

View File

@@ -1,12 +1,30 @@
# Lazymc requires that the minecraft server have a static IP.
#
# To ensure that our servers have a static IP we need to create
# a network for our services to use.
#
# By default, Docker uses 172.17.0.0/16 subnet range.
# So we need to create a new network in a different subnet
# See the readme for more information.
#
# Please ensure that the subnet falls within the private CIDRs:
# https://datatracker.ietf.org/doc/html/rfc1918#section-3
#
# And that it is not in use by anything else.
networks:
minecraft-network:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16
services: services:
lazymc: lazymc:
container_name: lazymc
image: ghcr.io/joesturge/lazymc-docker-proxy:latest image: ghcr.io/joesturge/lazymc-docker-proxy:latest
environment: # the IPs should start at .2 as .1 is reserved for the gateway
# Point to the service name of the Minecraft server networks:
SERVER_ADDRESS: mc:25565 minecraft-network:
# Required to find the container to manage it ipv4_address: 172.18.0.2
LAZYMC_GROUP: mc
restart: unless-stopped restart: unless-stopped
volumes: volumes:
# you should mount the minecraft server dir under /server, using read only. # you should mount the minecraft server dir under /server, using read only.
@@ -21,11 +39,19 @@ services:
# Standard Docker Minecraft server, also works with other server types # Standard Docker Minecraft server, also works with other server types
mc: mc:
image: itzg/minecraft-server:java21 image: itzg/minecraft-server:java21
container_name: minecraft-server # Assign a static IP to the server container
networks:
minecraft-network:
ipv4_address: 172.18.0.3
# We need to add a label here so that lazymc-docker-proxy knows which # We need to add a label here so that lazymc-docker-proxy knows which
# container to manage # container to manage
labels: labels:
# Set lazymc.enabled to true to enable lazymc on this container
- lazymc.enabled=true
# Required to find the container to manage it
- lazymc.group=mc - lazymc.group=mc
# Point to the service name of the Minecraft server
- lazymc.server.address=mc:25565
tty: true tty: true
stdin_open: true stdin_open: true
# This container should be managed solely by the lazymc container # This container should be managed solely by the lazymc container

View File

@@ -37,7 +37,12 @@ mc_server_listening() {
java_clients_connections() { java_clients_connections() {
local connections local connections
if java_running; then if java_running; then
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --show-player-count); then if ! connections=$(mc-monitor status \
--host "${SERVER_HOST:-localhost}" \
--port "$SERVER_PORT" \
--retry-limit "${AUTOPAUSE_STATUS_RETRY_LIMIT:-10}" --retry-interval "${AUTOPAUSE_STATUS_RETRY_INTERVAL:-2s}" \
$(use_proxy) $(use_server_list_ping) \
--show-player-count); then
# consider it a non-zero player count if the ping fails # consider it a non-zero player count if the ping fails
# otherwise a laggy server with players connected could get paused # otherwise a laggy server with players connected could get paused
connections=1 connections=1

View File

@@ -24,6 +24,7 @@
"cherished-worlds", "cherished-worlds",
"chunk-animator", "chunk-animator",
"clickable-advancements", "clickable-advancements",
"compass-coords",
"configured", "configured",
"controlling", "controlling",
"craftpresence", "craftpresence",

View File

@@ -22,6 +22,7 @@
"cherishedworlds", "cherishedworlds",
"citresewn", "citresewn",
"clickadv", "clickadv",
"compass-coords",
"connectedness", "connectedness",
"connector", "connector",
"craftpresence", "craftpresence",
@@ -85,4 +86,4 @@
], ],
"globalForceIncludes": [], "globalForceIncludes": [],
"modpacks": {} "modpacks": {}
} }

View File

@@ -39,7 +39,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ "$(id -u)" = 0 ]; then
fi fi
fi fi
if isTrue "${SKIP_CHOWN_DATA}" || [[ $(stat -c "%u" /data) != "$UID" ]]; then if isFalse "${SKIP_CHOWN_DATA}" && [[ $(stat -c "%u" /data) != "$UID" ]]; then
log "Changing ownership of /data to $UID ..." log "Changing ownership of /data to $UID ..."
chown -R ${runAsUser}:${runAsGroup} /data chown -R ${runAsUser}:${runAsGroup} /data
fi fi

View File

@@ -38,8 +38,8 @@ if [ ! -e /data/eula.txt ]; then
log "" log ""
logError "Please accept the Minecraft EULA at" logError "Please accept the Minecraft EULA at"
logError " https://account.mojang.com/documents/minecraft_eula" logError " https://account.mojang.com/documents/minecraft_eula"
logError "by adding the following immediately after 'docker run':" logError "by setting the container environment variable "
logError " -e EULA=TRUE" logError "EULA to \"true\""
log "" log ""
exit 1 exit 1
fi fi
@@ -285,4 +285,4 @@ case "${TYPE^^}" in
exit 1 exit 1
;; ;;
esac esac