Project Icon

docker-minecraft-bedrock-server

Minecraft基岩版专用服务器Docker镜像 - 简化部署与管理

该Docker镜像专为Minecraft基岩版专用服务器设计,提供自动更新、自定义属性配置、模组和资源包支持以及权限管理等功能。通过环境变量实现便捷配置,支持Docker Compose和Kubernetes部署。镜像简化了服务器的设置和维护流程,适用于不同规模的Minecraft服务器运营需求。

Docker Pulls GitHub Issues Build Discord

Quickstart

The following starts a Bedrock Dedicated Server running a default version and exposing the default UDP port:

docker run -d -it -e EULA=TRUE -p 19132:19132/udp -v mc-bedrock-data:/data itzg/minecraft-bedrock-server

NOTE: if you plan on running a server for a longer amount of time it is highly recommended using a management layer such as Docker Compose or Kubernetes to allow for incremental reconfiguration and image upgrades.

Upgrading to the latest Bedrock server version

With the VERSION variable set to "LATEST", which is the default, then the Bedrock server can be upgraded by restarting the container. At every startup, the container checks for the latest version and upgrades, if needed.

The latest preview version can be requested by setting VERSION to "PREVIEW".

Looking for a Java Edition Server

For Minecraft Java Edition you'll need to use this image instead:

itzg/minecraft-server

Environment Variables

Container Specific

  • EULA (no default) : must be set to TRUE to accept the Minecraft End User License Agreement
  • VERSION (default is LATEST) : can be set to a specific server version or the following special values can be used:
    • LATEST : determines the latest (non-preview) version and can be used to auto-upgrade on container start
    • PREVIEW : determines the latest preview version and will auto-upgrade
    • otherwise any specific server version can be provided. If it is a preview version, also set PREVIEW to "true"
  • UID (default derived from /data owner) : can be set to a specific user ID to run the bedrock server process
  • GID (default derived from /data owner) : can be set to a specific group ID to run the bedrock server process
  • TZ (no default): can be set to a specific timezone like America/New_York. This will set the timezone for the Docker container and therefore their logs. Addtionally, if you want to sync the time with the host, you can mount the /etc/localtime file from the host to the container like /etc/localtime:/etc/localtime:ro.
  • PACKAGE_BACKUP_KEEP (2) : how many package backups to keep

Server Properties

The following environment variables will set the equivalent property in server.properties, where each is described here. Typically, each property is configured instead by the UPPER_SNAKE_CASE equivalent.

  • SERVER_NAME
  • GAMEMODE
  • FORCE_GAMEMODE
  • DIFFICULTY
  • ALLOW_CHEATS
  • MAX_PLAYERS
  • ONLINE_MODE
  • WHITE_LIST
  • ALLOW_LIST
  • SERVER_PORT
  • SERVER_PORT_V6
  • ENABLE_LAN_VISIBILITY
  • VIEW_DISTANCE
  • TICK_DISTANCE
  • PLAYER_IDLE_TIMEOUT
  • MAX_THREADS
  • LEVEL_NAME
  • LEVEL_SEED
  • LEVEL_TYPE
  • DEFAULT_PLAYER_PERMISSION_LEVEL
  • TEXTUREPACK_REQUIRED
  • CONTENT_LOG_FILE_ENABLED
  • CONTENT_LOG_LEVEL
  • CONTENT_LOG_CONSOLE_OUTPUT_ENABLED
  • COMPRESSION_THRESHOLD
  • COMPRESSION_ALGORITHM
  • SERVER_AUTHORITATIVE_MOVEMENT
  • PLAYER_POSITION_ACCEPTANCE_THRESHOLD
  • PLAYER_MOVEMENT_SCORE_THRESHOLD
  • PLAYER_MOVEMENT_ACTION_DIRECTION_THRESHOLD
  • PLAYER_MOVEMENT_DISTANCE_THRESHOLD
  • PLAYER_MOVEMENT_DURATION_THRESHOLD_IN_MS
  • CORRECT_PLAYER_MOVEMENT
  • SERVER_AUTHORITATIVE_BLOCK_BREAKING
  • SERVER_AUTHORITATIVE_BLOCK_BREAKING_PICK_RANGE_SCALAR
  • CHAT_RESTRICTION
  • DISABLE_PLAYER_INTERACTION
  • CLIENT_SIDE_CHUNK_GENERATION_ENABLED
  • BLOCK_NETWORK_IDS_ARE_HASHES
  • DISABLE_PERSONA
  • DISABLE_CUSTOM_SKINS
  • SERVER_BUILD_RADIUS_RATIO
  • ALLOW_OUTBOUND_SCRIPT_DEBUGGING
  • ALLOW_INBOUND_SCRIPT_DEBUGGING
  • FORCE_INBOUND_DEBUG_PORT
  • SCRIPT_DEBUGGER_AUTO_ATTACH
  • SCRIPT_DEBUGGER_AUTO_ATTACH_CONNECT_ADDRESS
  • SCRIPT_WATCHDOG_ENABLE
  • SCRIPT_WATCHDOG_ENABLE_EXCEPTION_HANDLING
  • SCRIPT_WATCHDOG_ENABLE_SHUTDOWN
  • SCRIPT_WATCHDOG_HANG_EXCEPTION
  • SCRIPT_WATCHDOG_HANG_THRESHOLD
  • SCRIPT_WATCHDOG_SPIKE_THRESHOLD
  • SCRIPT_WATCHDOG_SLOW_THRESHOLD
  • SCRIPT_WATCHDOG_MEMORY_WARNING
  • SCRIPT_WATCHDOG_MEMORY_LIMIT
  • OP_PERMISSION_LEVEL
  • EMIT_SERVER_TELEMETRY
  • MSA_GAMERTAGS_ONLY
  • ITEM_TRANSACTION_LOGGING_ENABLED

For example, to configure a flat, creative server instead of the default use:

docker run -d -it --name bds-flat-creative \
  -e EULA=TRUE -e LEVEL_TYPE=flat -e GAMEMODE=creative \
  -p 19132:19132/udp itzg/minecraft-bedrock-server

Exposed Ports

  • UDP 19132 : the Bedrock server port. NOTE that you must append /udp when exposing the port, such as -p 19132:19132/udp

Volumes

  • /data : the location where the downloaded server is expanded and ran. Also contains the configuration properties file server.properties

You can create a named volume and use it as:

docker volume create mc-volume
docker run -d -it --name mc-server -e EULA=TRUE -p 19132:19132/udp -v mc-volume:/data itzg/minecraft-bedrock-server

If you're using a named volume and want the bedrock process to run as a non-root user then you will need to pre-create the volume and chown it to the desired user.

For example, if you want the bedrock server to run with user ID 1000 and group ID 1000, then create and chown the volume named "bedrock" using:

docker run --rm -v bedrock:/data alpine chown 1000:1000 /data

If using docker run then simply reference that volume "bedrock" in the -v argument. If using a compose file, declare the volume as an external using this type of declaration:

volumes:
  bedrock:
    external:
      name: bedrock

Connecting

When running the container on your LAN, you can find and connect to the dedicated server in the "LAN Games" part of the "Friends" tab, such as:

Permissions

The Bedrock Dedicated Server requires permissions be defined with XUIDs. There are various tools to look these up online and they are also printed to the log when a player joins. There are 3 levels of permissions and 3 options to configure each group:

  • OPS is used to define operators on the server.
-e OPS="1234567890,0987654321"
  • MEMBERS is used to define the members on the server.
-e MEMBERS="1234567890,0987654321"
  • VISITORS is used to define visitors on the server.
-e VISITORS="1234567890,0987654321"

Allowlist

There are two ways to handle a whitelist:

The first is to set the ALLOW_LIST environment variable to true and map in an allowlist.json file (previously known as "whitelist.json") that is custom-crafted to the container.

The other is to set the ALLOW_LIST_USERS environment variable to a comma-separated list of gamer tag usernames and their corresponding XUIDs. Each username should be followed by its XUID, separated by a colon. The server will use these details to match the player.

There are various tools to look XUIDs up online and they are also printed to the log when a player joins the server.

-e ALLOW_LIST_USERS="player1:1234567890,player2:0987654321"

Mods Addons

Also known as behavior or resource packs, in order to add mods into your server you can follow these steps, tested with OPS (One Player Sleep) and bedrocktweaks

  1. Install the mcpack or mcaddon on the client side first, just to make it easier to copy the files to the server, for Windows 10 files should be located on C:\Users\USER\AppData\Local\Packages\Microsoft.MinecraftUWP_*\LocalState\games\com.mojang.
  2. Copy over the folders of the mods from either behavior_packs or resource_packs into the server's volume.

If you want to install them without using a client you should be able to unzip the mods directly into the server's volume, .mcaddon should go into behavior_packs and .mcpack into resource_packs. Both .mcaddon and .mcpack are actually renamed .zip files.

  1. Lastly create on the server's volume worlds/$level-name/world_behavior_packs.json, you'll need to add an entry for each mod like on the previous manifest.json, we only need the uuid now called pack_id and the version replacing dots with commas and double quotes with [ ].

You can also create a worlds/$level-name/world_resource_packs.json but I have seen that putting both resource and behavior packs inside the same json works just fine

[
	{
		"pack_id" : "5f51f7b7-85dc-44da-a3ef-a48d8414e4d5",
		"version" : [ 3, 0, 0 ]
	}
]
  1. Restart the server and the mods should be enabled now! when connecting you will get a prompt asking if you want to "Download & Join" or just "Join", You need to Download & Join if you want to actually see the new resource pack added to the server. This prompt is exclusive to resource packs as these alter how minecraft looks while behavior packs alter how minecraft functions and don't need to be downloaded or installed on the client side.

If you want to force the resource pack on all clients, there's an option texturepack-required=false in server.properties that should be changed to true. Resource packs can be deleted by going into Settings > Storage > Cached Data, then selecting the pack and clicking on the trash can.

For more information FoxyNoTail did a video explaining the same on a server running on Windows.

More information

For more information about managing Bedrock Dedicated Servers in general, check out this Reddit post.

Executing server commands

This image comes bundled with a script called send-command that will send a Bedrock command and argument to the Bedrock server console. The output of the command only be visible in the container logs.

For example:

docker exec CONTAINER_NAME_OR_ID send-command gamerule dofiretick false

Alternatively, with stdin and tty enabled (such as using -it), attach to the container's console by its name or ID using:

docker attach CONTAINER_NAME_OR_ID

While attached, you can execute any server-side commands, such as op'ing your player to be admin:

gamerule dofiretick false

When finished, detach from the server console using Ctrl-p, Ctrl-q

Deploying with Docker Compose

The examples directory contains an example Docker compose file that declares:

  • a service running the bedrock server container and exposing UDP port 19132. In the example is named "bds", short for "Bedrock Dedicated Server", but you can name the service whatever you want
  • a volume attached to the service at the container path /data
services:
  bds:
    image: itzg/minecraft-bedrock-server
    environment:
      EULA: "TRUE"
    ports:
      - "19132:19132/udp"
    volumes:
      - ./data:/data
    stdin_open: true
    tty: true

Start the server and run in the background using:

docker compose up -d

You can follow the logs at any time using:

docker compose logs -f

Deploying with Kubernetes

The examples directory contains an example Kubernetes manifest file that declares:

  • a peristent volume claim (using default storage class)
  • a pod deployment that uses the declared PVC
  • a service of type LoadBalancer

The pod deployment includes some examples of configuring the server properties via environment variables:

env:
- name: EULA
  value: "TRUE"
- name: GAMEMODE
  value: survival
- name: DIFFICULTY
  value: normal

The file is deploy-able as-is on most clusters, but has been confirmed on Docker for Desktop and Google Kubernetes Engine:

kubectl apply -f examples/kubernetes.yml

You can follow the logs of the deployment using:

kubectl logs -f deployment/bds

Community Solutions

Tutorials

@TheTinkerDad provides an excellent tutorial on how to host multiple instances on a single port (19132) so that it's discoverable: https://www.youtube.com/watch?v=ds0_ESzjbfs

Contributing

When trying to build this Docker Image, ensure that all .sh files have a end of line sequence of LF not CLRF or the build will

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号