docker-bungeecord

docker-bungeecord

Minecraft多服务器代理Docker镜像 BungeeCord和Velocity支持

这是一个支持BungeeCord和Velocity的Minecraft代理服务器Docker镜像。它可与itzg/minecraft-server容器配合使用,提供内存配置、插件下载、RCON等多种设置选项。镜像支持通过卷挂载自定义配置,内置健康检查功能,并允许变量替换和文件修补,实现灵活的运行时配置。适用于需要搭建Minecraft多服务器架构的用户。

DockerMinecraftBungeeCordVelocity代理服务器Github开源项目

This is a Docker image that provides a choice of Minecraft proxies, such as BungeeCord and Velocity. It is intended to be used in combination with itzg/minecraft-server containers.

Build and Publish

Using with itzg/minecraft-server image

When using with the server image itzg/minecraft-server you can disable online mode, which is required by bungeecord, by setting ONLINE_MODE=FALSE, such as

docker run ... -e ONLINE_MODE=FALSE itzg/minecraft-server

The following is an example that can be started with docker compose up -d:

services: mc: image: itzg/minecraft-server environment: EULA: "TRUE" ONLINE_MODE: "FALSE" volumes: - mc-data:/data proxy: image: itzg/mc-proxy environment: BUNGEE_JAR_REVISION: "1" CFG_MOTD: Powered by Docker REPLACE_ENV_VARIABLES: "true" ports: - "25565:25577" volumes: - ./config.yml:/config/config.yml - proxy-data:/server volumes: mc-data: proxy-data:

Healthcheck

This image contains 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

CONTAINER ID    IMAGE    COMMAND                         CREATED           STATUS                     PORTS                       NAMES
b418af073764    mc       "/usr/bin/run-bungeecord.sh"    43 seconds ago    Up 41 seconds (healthy)    0.0.0.0:25577->25577/tcp    mc

You can also query the container's health in a script friendly way:

> docker container inspect -f "{{.State.Health.Status}}" mc
healthy

Environment Settings

  • TYPE=BUNGEECORD

    The type of the server. When the type is set to CUSTOM, the environment setting BUNGEE_JAR_URL is required.

    Possible values:

  • MEMORY=512m

    The Java memory heap size to specify to the JVM. Setting this to an empty string will let the JVM calculate the heap size from the container declared memory limit. Be sure to consider adding -XX:MaxRAMPercentage=<n> (with <n> replaced) to JVM_XX_OPTS, where the JVM default is 25%.

  • ICON

    Setting this to an image URL will download and (if required) convert the icon to a 64x64 PNG, and place it in /server/server-icon.png.

  • OVERRIDE_ICON

    Will override any pre-existing server-icon.png file in the /server directory if ICON is set.

  • INIT_MEMORY=${MEMORY}

    Can be set to use a different initial heap size.

  • MAX_MEMORY=${MEMORY}

    Can be set to use a different max heap size.

  • JVM_OPTS / JVM_XX_OPTS

    Additional space-separated options to pass to the JVM, where JVM_XX_OPTS will be added to the java command-line before JVM_OPTS.

  • NETWORKADDRESS_CACHE_TTL=60

    Number of seconds to cache the successful network address lookups. A lower value is helpful when Minecraft server containers are restarted and/or rescheduled and re-assigned a new container IP address.

  • PLUGINS

    Used to download a comma seperated list of *.jar urls to the plugins folder.

    -e PLUGINS=https://www.example.com/plugin1.jar,https://www.example.com/plugin2.jar
    
  • SPIGET_PLUGINS

    The SPIGET_PLUGINS variable can be set with a comma-separated list of SpigotMC resource IDs to automatically download SpigotMC plugins using the spiget API. Resources that are zip files will be expanded into the plugins directory and resources that are simply jar files will be moved there.

    NOTE: the variable is purposely spelled SPIGET with an "E"

    The resource ID can be located from the numerical part of the URL after the shortname and a dot. For example, the ID is 313 from

    https://www.spigotmc.org/resources/bungeetablistplus.313/
                                                         ===
    
  • MODRINTH_PROJECTS

    Comma or newline separated list of project slugs (short name) or IDs. The project ID is located in the "Technical information" section. The slug is the part of the page URL that follows /mod/:

      https://modrinth.com/mod/fabric-api
                               ----------
                                |
                                +-- project slug
    

    Also, a specific version/type can be declared using colon symbol and version id/type after the project slug. The version id can be found in the 'Metadata' section. Valid version types are release, beta, alpha.

    Dependency resolution can be adjusted by setting MODRINTH_DOWNLOAD_DEPENDENCIES to none, optional, or required (the default).

    NOTE The variable MINECRAFT_VERSION must be set to the corresponding Minecraft version.

  • ENABLE_RCON

    Enable the rcon server (uses a third-party plugin to work).

  • RCON_PORT

    Define the port for rcon

  • RCON_PASSWORD

    Define the password for rcon

Optional Environment Settings

  • BUNGEE_JOB_ID=lastStableBuild

    The Jenkins job ID of the artifact to download and run and is used when deriving the default value of BUNGEE_JAR_URL

  • BUNGEE_JAR_REVISION

    Defaults to the value of ${BUNGEE_JOB_ID}, but can be set to an arbitrarily incremented value to force an upgrade of the downloaded BungeeCord jar file.

  • BUNGEE_BASE_URL

    Default to:

    Used to derive the default value of BUNGEE_JAR_URL

  • BUNGEE_JAR_URL

    If set, can specify a custom, fully qualified URL of the BungeeCord.jar; however, you won't be able reference the other environment variables from within a docker run a compose file. Defaults to:

    • (type: BUNGEECORD): ${BUNGEE_BASE_URL}/${BUNGEE_JOB_ID}/artifact/bootstrap/target/BungeeCord.jar

    This takes precedence over BUNGEE_JAR_FILE.

  • BUNGEE_JAR_FILE

    For TYPE=CUSTOM, allows setting a custom BungeeCord JAR that is located inside the container.

    Must be a valid path of an existing file.

  • WATERFALL_VERSION=latest

    For TYPE=WATERFALL, allows downloading a specific release stream of Waterfall.

  • WATERFALL_BUILD_ID=latest

    For TYPE=WATERFALL, allows downloading a specific build of Waterfall within the given version.

  • VELOCITY_VERSION=latest

    For TYPE=VELOCITY, specifies the version of Velocity to download and run.

  • VELOCITY_BUILD_ID=latest

    For TYPE=VELOCITY, allows downloading a specific build of Velocity within the given version.

  • HEALTH_HOST=localhost

    Allows for configuring the host contacted for container health check.

  • HEALTH_USE_PROXY=false

    Set to "true" when using Bungeecord's proxy_protocol option

  • ENABLE_JMX=false

    To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable ENABLE_JMX=true, set JMX_HOST to the IP/host running the Docker container, and add a port forwarding of TCP port 7091

Volumes

  • /server

    The working directory where BungeeCord is started. This is the directory where its config.yml will be loaded.

  • /plugins

    Plugins will be copied across from this directory before the server is started.

  • /config

    The contents of this directory will be synchronized into the /server directory. Variable placeholders within the files will be processed as described in the section below unless REPLACE_ENV_DURING_SYNC is set to "false".

Ports

  • 25577

    The listening port of BungeeCord, which you will typically want to port map to the standard Minecraft server port of 25565 using:

    -p 25565:25577
    

Java Versions

The following table shows the Java versions and CPU architectures supported by the image tags:

TagJavaArchitectures
latest17amd64, arm64, armv7
java88amd64, arm64, armv7
java1111amd64, arm64, armv7

Interacting with the server

RCON is enabled by default, so you can exec into the container to access the Bungeecord server console:

docker exec -i mc rcon-cli

Note: The -i is required for interactive use of rcon-cli.

To run a simple, one-shot command, such as stopping a Bungeecord server, pass the command as arguments to rcon-cli, such as:

docker exec mc rcon-cli en

The -i is not needed in this case.

In order to attach and interact with the Bungeecord server, add -it when starting the container, such as

docker run -d -it -p 25565:25577 --name mc itzg/mc-proxy

With that you can attach and interact at any time using

docker attach mc

and then Control-p Control-q to detach.

For remote access, configure your Docker daemon to use a tcp socket (such as -H tcp://0.0.0.0:2375) and attach from another machine:

docker -H $HOST:2375 attach mc

Unless you're on a home/private LAN, you should enable TLS access.

BungeeCord Configuration

BungeeCord Configuration Guide

Generic pack files

To install all the server content (jars, mods, plugins, configs, etc.) from a zip or tgz file, then set GENERIC_PACK to the container path or URL of the archive file.

If multiple generic packs need to be applied together, set GENERIC_PACKS instead, with a comma separated list of archive file paths and/or URLs to files.

To avoid repetition, each entry will be prefixed by the value of GENERIC_PACKS_PREFIX and suffixed by the value of GENERIC_PACKS_SUFFIX, both of which are optional. For example, the following variables

GENERIC_PACKS=configs-v9.0.1,mods-v4.3.6
GENERIC_PACKS_PREFIX=https://cdn.example.org/
GENERIC_PACKS_SUFFIX=.zip

would expand to https://cdn.example.org/configs-v9.0.1.zip,https://cdn.example.org/mods-v4.3.6.zip.

Replacing variables inside configs

Sometimes you have mods or plugins that require configuration information that is only available at runtime. For example if you need to configure a plugin to connect to a database, you don't want to include this information in your Git repository or Docker image. Or maybe you have some runtime information like the server name that needs to be set in your config files after the container starts.

For those cases there is the option to replace defined variables inside your configs with environment variables defined at container runtime.

If you set the environment variable REPLACE_ENV_VARIABLES to TRUE the startup script will go through all files inside your /server volume and replace variables that match your defined environment variables. Variables that you want to replace need to be declared as ${YOUR_VARIABLE}, which is common with shell scripting languages.

With REPLACE_ENV_VARIABLE_PREFIX you can define a prefix, where the default is CFG_, to only match predefined environment variables.

If you want to use a file for a value (such as when using Docker secrets) you can add suffix _FILE to your variable name (in run command). For example, ${CFG_PASSWORD_FILE} would be replaced with the contents of the file specified by the CFG_PASSWORD_FILE environment variable.

Here is a full example where we want to replace values inside a database.yml.

--- database: host: ${CFG_DB_HOST} name: ${CFG_DB_NAME} password: ${CFG_DB_PASSWORD}

This is how your docker-compose.yml file could look like:

version: "3.8" # Other docker-compose examples in /examples services: proxy: image: itzg/mc-proxy ports: - "25577:25577" volumes: - "proxy:/server" environment: # enable env variable replacement REPLACE_ENV_VARIABLES: "TRUE" # define an optional prefix for your env variables you want to replace ENV_VARIABLE_PREFIX: "CFG_" # and here are the actual variables CFG_DB_HOST: "http://localhost:3306" CFG_DB_NAME: "minecraft" CFG_DB_PASSWORD_FILE: "/run/secrets/db_password" restart: always volumes: proxy: secrets: db_password: file: ./db_password

The content of db_password:

ug23u3bg39o-ogADSs

Patching existing files

JSON path based patches can be applied to one or more existing files by setting the variable PATCH_DEFINITIONS to the path of a directory that contains one or more patch definition json files or a patch set json file.

JSON path based patches can be applied to one or more existing files by setting the variable PATCH_DEFINITIONS to the path of a directory that contains one or more patch definition json files or a patch set json file.

The file and value fields of the patch definitions may contain ${...} variable placeholders. The allowed environment variables in placeholders can be restricted by setting REPLACE_ENV_VARIABLE_PREFIX, which defaults to "CFG_".

The following example shows a patch-set file were various fields in the paper.yaml configuration file can be modified and added:

{ "patches": [ { "file": "/data/paper.yml", "ops": [ { "$set": { "path": "$.verbose", "value": true } }, { "$set": { "path": "$.settings['velocity-support'].enabled", "value": "${CFG_VELOCITY_ENABLED}", "value-type": "bool" } }, { "$put": { "path": "$.settings", "key": "my-test-setting", "value": "testing" } } ] } ] }

Supports the file formats:

  • JSON
  • JSON5
  • Yaml
  • TOML, but processed output is not pretty

Scenarios

Running non-root

This image may be run as a non-root user but does require an attached /server volume that is writable by that uid, such as:

docker run ... -u $uid -v $(pwd)/data:/server itzg/mc-proxy

Java Versions

The latest image tag is based on Java 21, but alternate image tags are available to run with a different java version.

The image Java variant can be used as shown here:

itzg/mc-proxy:{variant}

or using release version, such as 2024.5.0

itzg/mc-proxy:{release}-{variant}
VariantJava VersionCPU types
latest21amd64,arm64
java2121amd64,arm64
java1717amd64,arm64,armv7
java1111amd64,arm64,armv7
java88amd64,arm64,armv7

编辑推荐精选

蛙蛙写作

蛙蛙写作

AI小说写作助手,一站式润色、改写、扩写

蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。

AI助手AI工具AI写作工具AI辅助写作蛙蛙写作学术助手办公助手营销助手
Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

聊天机器人AI助手热门AI工具AI对话
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

热门AI工具AI办公办公工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

模型训练热门AI工具内容创作智能问答AI开发讯飞星火大模型多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

下拉加载更多