Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Image for Arm64 #140

Closed
PatrykPlewaOfficial opened this issue Mar 19, 2021 · 23 comments · Fixed by #314
Closed

[Request] Image for Arm64 #140

PatrykPlewaOfficial opened this issue Mar 19, 2021 · 23 comments · Fixed by #314

Comments

@PatrykPlewaOfficial
Copy link

Hi,
Would You be willing to provide an image for Arm64 architecture (if is's event possible)?

@itzg
Copy link
Owner

itzg commented Mar 19, 2021

I'd be willing 😀 but it's not possible since Mojang only provides an x86 executable

https://www.minecraft.net/en-us/download/server/bedrock/

@PatrykPlewaOfficial
Copy link
Author

PatrykPlewaOfficial commented Mar 21, 2021

Everyone seeing this issue, I recommend to put some pressure on Mojang, for instance by upvoting this request:
Dedicated Servers for ARM Devices

@itzg
Copy link
Owner

itzg commented Mar 21, 2021

I voted!

@ryancurrah
Copy link

I voted as well. Thank you!

@xunholy
Copy link

xunholy commented Jan 10, 2022

Just bumping into this issue as well @itzg we could potentially create an arm64 image and use https://github.com/anujdatar/box86-docker to bridge the architecture from x86 - This could be a nice temporary solution until upstream supports dedicated ARM support. Thoughts?

@itzg
Copy link
Owner

itzg commented Jan 11, 2022

Interesting solution @xunholy ! I hadn't heard of that before. It seems to be 32 bit only, which is ok for targeting RaspberryPi but misses out on the advantages of arm64 platforms. Makes me think though that qemu might be option too.

@xunholy
Copy link

xunholy commented Feb 13, 2022

@itzg any further investigation been done on this front? QEMU could also work with using docker buildx.

@itzg
Copy link
Owner

itzg commented Feb 13, 2022

I haven't made any progress and don't have access to an arm64 platform. You can always fork this image and experiment from there.

@itzg
Copy link
Owner

itzg commented Feb 14, 2022

...I'm wondering if you can use a similar approach as

https://www.stereolabs.com/docs/docker/building-arm-container-on-x86/

but in your case it's running qemu on arm64 to emulate amd64

@TukangM
Copy link

TukangM commented Feb 18, 2022

hooh, mojang kind suck

@TukangM
Copy link

TukangM commented Feb 18, 2022

someone can create translator x86 x64 ???

@TukangM
Copy link

TukangM commented Feb 18, 2022

I want to run bedrock deditated server on termux / native ubuntu touch, but it can't run x86 code, can anyone make an arm > x86 translator??

@itzg
Copy link
Owner

itzg commented Feb 18, 2022

@Jashepp
Copy link

Jashepp commented Apr 29, 2022

I got this working on my Raspberry Pi 4 (arm64) using box64 https://github.com/ptitSeb/box64 (built on host, then installed on host)
I simply edited the arch to arm64 in the dockerfile and copied over the built/installed box64 files (so the arm64 executables can be ran).
I tested it for a few hours and it seems to run very well.

@TukangM
Copy link

TukangM commented Apr 30, 2022

box64 is op but cant run on termux . proot-distro or AnLinux. when server running i try connect stuck at loacting server..

@itzg
Copy link
Owner

itzg commented Apr 30, 2022

I simply edited the arch to arm64 in the dockerfile and copied over the built/installed box64 files (so the arm64 executables can be ran).

@Jashepp very interesting. Can you expand on the specifics for that 👆

@cduran
Copy link

cduran commented May 13, 2022

@Jashepp I did a clean install on my raspberry pi and built the box64 binary. But was not able to run it. When you have a chance can you elaborate more on the process on getting this running?

@Jashepp
Copy link

Jashepp commented May 13, 2022

Hey, here's more info about it:

Edit dockerfile to have ARG ARCH=arm64 instead of amd64. Then rebuild the docker image.

I built box64 on the host (my Raspberry Pi 4) with: (notice the -DRPI4ARM64=1 argument for rasp pi 4. Different argument for each arm64 CPU type)

sudo apt install git build-essential cmake
git clone https://github.com/ptitSeb/box64.git ./repo

mkdir ./repo/build
cd ./repo/build
cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j$(nproc)

# if running again after already installed, also call: sudo make uninstall
sudo make install
sudo systemctl restart systemd-binfmt

(The 5 files listed below, are the files listed when running make install. They might change in future versions of box64)

Then with docker, I can either edit the image to include:

COPY /usr/local/bin/box64 /usr/local/bin/box64
COPY /etc/binfmt.d/box64.conf /etc/binfmt.d/box64.conf
COPY /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
COPY /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
COPY /usr/lib/x86_64-linux-gnu/libpng12.so.0 /usr/lib/x86_64-linux-gnu/libpng12.so.0

Or simply use volumes when creating the docker container: (i now use this method)

    volumes:
      - '/usr/local/bin/box64:/usr/local/bin/box64'
      - '/etc/binfmt.d/box64.conf:/etc/binfmt.d/box64.conf'
      - '/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libstdc++.so.6'
      - '/usr/lib/x86_64-linux-gnu/libgcc_s.so.1:/usr/lib/x86_64-linux-gnu/libgcc_s.so.1'
      - '/usr/lib/x86_64-linux-gnu/libpng12.so.0:/usr/lib/x86_64-linux-gnu/libpng12.so.0'

A good way to test is to add the BOX64_LOG environment variable to the docker container:

    environment:
      BOX64_LOG: "INFO"

Docker output when ran:

Creating mc-bedrock ... done
DEBU[0000] Using /data to match uid and gid             
DEBU[0000] Resolved UID=0 from match path               
DEBU[0000] Resolved GID=0 from match path               
Looking up latest version...
Updating permissions
Starting Bedrock server...
Dynarec for ARM64, with extension: ASIMD CRC32 PageSize:4096
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 29 Env var
Looking for /data/bedrock_server-1.18.32.02
Using native(wrapped) libz.so.1
Using native(wrapped) libnsl.so.1
Using native(wrapped) libssl.so.1
Using native(wrapped) libcrypto.so.1
Using native(wrapped) libdl.so.2
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libpthread.so.0
Using emulated /usr/lib/x86_64-linux-gnu/libstdc++.so.6
Using emulated /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
NO LOG FILE! - setting up server logging...
[2022-05-13 06:53:54:339 INFO] Starting Server
[2022-05-13 06:53:54:342 INFO] Version 1.18.32.02
[2022-05-13 06:53:54:342 INFO] Session ID f2446712-c265-42f4-807c-4ea55c741b52
[2022-05-13 06:53:54:515 INFO] Level Name: Bedrock level
[2022-05-13 06:53:54:544 INFO] Game mode: 0 Survival
[2022-05-13 06:53:54:546 INFO] Difficulty: 1 EASY
[2022-05-13 06:53:55:069 INFO] opening worlds/Bedrock level/db
Warning, call to __cxa_thread_atexit_impl(0x319a140, 0x55bbefcc98, 0x62d7358) ignored
[2022-05-13 06:54:07:048 INFO] IPv4 supported, port: 19132
[2022-05-13 06:54:07:048 INFO] IPv6 supported, port: 19133
[2022-05-13 06:54:09:919 INFO] Server started.

box64 works almost perfectly. The only bug I've noticed in-game is invisible skins for other players which randomly fixes itself on random occasion. But everything else seems fine, and it's playable, with decent performance (much more so than the java version).

The only times I've had issues running it with box64 is when I've had file corruption due to internet packet loss when downloading/cloning box64 before building it. Trying again at a later time fixed it for me.

Edit: I just noticed that there is now an apt install method for box64 found here. Having that run on each docker container boot might be an idea, for an image that could work on maybe any arm64 device.

@PatrykPlewaOfficial
Copy link
Author

Great success @Jashepp! Thank you for your contribution.

Your initial approach wasn't working for me, but I made some changes to the Dockerfile and installed box64 directly in the Docker runtime.

After some changes, the middle part looks like this:

...
ARG ARCH=arm64

ARG APT_UPDATE=20210112

RUN apt-get update && \
  DEBIAN_FRONTEND=noninteractive apt-get install -y \
    curl \
    unzip \
    jq \
    debian-keyring \
    wget \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Instal box64
RUN wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list && \
  wget -O- https://ryanfortner.github.io/box64-debs/KEY.gpg | gpg --dearmor | tee /usr/share/keyrings/box64-debs-archive-keyring.gpg && \
  apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  box64

EXPOSE 19132/udp

VOLUME ["/data"]
...

I will try to work on the performance of the server because it is not perfect. The lags are visible and some destroyed blocks tend to reappear but overall it is, so far, the greatest success in bringing Minecraft Bedrock to ARM64.

Cheers!

jinnosukeKato added a commit to jinnosukeKato/docker-minecraft-bedrock-server-arm64 that referenced this issue Aug 1, 2022
@strausmann
Copy link

And how are the experiences so far? Is the ARM server stable?

@sandym
Copy link
Contributor

sandym commented Jan 6, 2023

For the past few days, I've been playing with the server running in a Kubernetes node on a raspberry pi 4. The performance seems better or as good as my old coreduo 2 server.

I've submitted a PR here.

@travisboss
Copy link

travisboss commented Feb 27, 2023

For the past few days, I've been playing with the server running in a Kubernetes node on a raspberry pi 4. The performance seems better or as good as my old coreduo 2 server.

I've submitted a PR here.

I see your PR was committed, how does one add this build arg to there compose file to test?

  bds:
    image: itzg/minecraft-bedrock-server
    container_name: bds
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - ARCH=arm64
    environment:
      - EULA=TRUE
      - GAMEMODE=survival
      - DIFFICULTY=normal
    ports:
      - 19132:19132/udp
    volumes:
      - ./minecraft:/data
    stdin_open: true
    tty: true

Here is what I tried, running on Oracle Cloud ARM free.

@itzg
Copy link
Owner

itzg commented Apr 10, 2023

The latest image is now multi-architecture!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants