# FoundationDB on docker/mac m2

**URL:** <https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876>\
**Category:** Using FoundationDB\
**Created:** [March 29, 2023, 6:39am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876 "2023-03-29T06:39:52Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mping-exo](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/mping-exo/32/1374_2.png) [@mping-exo](https://forums.foundationdb.org/u/mping-exo)\
**Post date:** [March 29, 2023, 6:39am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/1 "2023-03-29T06:39:52Z")

</div>

Has anybody had any success running foundationdb/foundationdb image on docker? I run with `--platform linux/amd64` while there are no apple silicon images available, but I hit the following:

```auto
foundation-1 | <jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
foundation-1 | <jemalloc>: (This is the expected behaviour if you are running under QEMU)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | Configuring database
foundation-1 | Starting FDB server on 127.0.0.1:4500
foundation-1 | <jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
foundation-1 | <jemalloc>: (This is the expected behaviour if you are running under QEMU)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)
foundation-1 | ERROR: Disk i/o operation failed (1510)

```

I also tried supplying `--knob_disable_posix_kernel_aio=1` but it didn’t make a difference.

---

<div class="post-metadata">

**Author:** ![johscheuer](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@johscheuer](https://forums.foundationdb.org/u/johscheuer)\
**Post date:** [March 30, 2023, 5:02am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/2 "2023-03-30T05:02:27Z")

</div>

Could you provide some more information like what Docker image you used? You should make sure to use the images with an even tag e.g. `7.1.28` as those have AVX disabled (I believe that’s not available in qemu).

Based on your comment it seems like you already tried this command: [Support Apple Silicon · Issue #4111 · apple/foundationdb · GitHub](https://github.com/apple/foundationdb/issues/4111#issuecomment-1284040423)?

Are you able to share the whole command that you used? I don’t have an M2 available, but I would expect that the M1 instructions work too.

---

<div class="post-metadata">

**Author:** ![mping-exo](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/mping-exo/32/1374_2.png) [@mping-exo](https://forums.foundationdb.org/u/mping-exo)\
**Post date:** [March 31, 2023, 8:17pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/3 "2023-03-31T20:17:58Z")

</div>

Thanks for your reply, unfortunately that doesn’t quite work either.  
I created a small repo for reproducing the issue:

> **[GitHub - mping/fdb-m2](https://github.com/mping/fdb-m2)**
>
> Contribute to mping/fdb-m2 development by creating an account on GitHub.

How hard is it to build an apple specific docker image? How long should a build take?

---

<div class="post-metadata">

**Author:** ![garrensmith](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/garrensmith/32/494_2.png) [@garrensmith](https://forums.foundationdb.org/u/garrensmith)\
**Post date:** [April 4, 2023, 4:44pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/4 "2023-04-04T16:44:55Z")

</div>

Not a perfect solution but we have an apple silicon version of foundationdb built here [Docker](https://hub.docker.com/r/tigrisdata/foundationdb) that you can try out.

---

<div class="post-metadata">

**Author:** ![mping-exo](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/mping-exo/32/1374_2.png) [@mping-exo](https://forums.foundationdb.org/u/mping-exo)\
**Post date:** [April 4, 2023, 6:03pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/5 "2023-04-04T18:03:50Z")

</div>

Thanks for the reply! Did you use [GitHub - FoundationDB/fdb-build-support: FoundationDB build and development resources](https://github.com/FoundationDB/fdb-build-support) for building that? I tried on an m2, and also tried cross-building via dockerx but didn’t have any luck with that.

---

<div class="post-metadata">

**Author:** ![mping-exo](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/mping-exo/32/1374_2.png) [@mping-exo](https://forums.foundationdb.org/u/mping-exo)\
**Post date:** [April 12, 2023, 2:48pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/6 "2023-04-12T14:48:44Z")

</div>

I was able to dig a little further, here’s what I found:

- to use fdb/docker on an apple sillicon, you need a `.pkg` with client libraries built for `arm64`
- the java fdb lib needs to match the fdb docker
- you can override lib locations via java properties (eg: `-DFDB_LIBRARY_PATH_FDB_C=xxx` and `-DFDB_LIBRARY_PATH_FDB_JAVA=yyy`
- I extracted the `libfdb.java.jnilib` from the maven jarfile and put it in `/usr/local/lib`, then `chmod 755 <file>`
  - You can test if the libraries are loadable via `(System/load "/usr/local/lib...)`, it shouldn’t barf
    - if the lib is for a different arch, using Azul SDK gives a more meaningful message:  
`/usr/local/lib/libfdb_c.dylib: dlopen(/usr/local/lib/libfdb_c.dylib, 0x0001): tried: '/usr/local/lib/libfdb_c.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libfdb_c.dylib' (no such file), '/usr/local/lib/libfdb_c.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) `
    - if the versions don’t match, you will see something like: `Execution error (UnsatisfiedLinkError) at jdk.internal.loader.NativeLibraries/load (NativeLibraries.java:-2). /usr/local/lib/libfdb_java.jnilib: dlopen(/usr/local/lib/libfdb_java.jnilib, 0x0001): Symbol not found: _fdb_database_blobbify_range Referenced from: <EE0D48C0-F8C3-3599-8EAA-C36B69D28883> /usr/local/lib/libfdb_java.jnilib Expected in: <24069827-7F2F-30D3-B9B5-B78D6EF7B8DA> /usr/local/lib/libfdb_c.dylib`

---

<div class="post-metadata">

**Author:** ![mping-exo](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/mping-exo/32/1374_2.png) [@mping-exo](https://forums.foundationdb.org/u/mping-exo)\
**Post date:** [April 18, 2023, 10:10am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/7 "2023-04-18T10:10:10Z")

</div>

So, the last version that works for me (on an m2) is `foundationdb/foundationb:7.1.24`. `7.1.26` throws the illegal instruction thingy:

```auto
docker run -ti --platform=linux/amd64 --entrypoint=bash -v $(pwd)/foundationdb:/fdb foundationdb/foundationdb:7.1.24
[root@8d6f4438923e /]# sed -i '$ s/$/ --knob_disable_posix_kernel_aio=1/' /var/fdb/scripts/fdb.bash
[root@8d6f4438923e /]# /var/fdb/scripts/fdb.bash
Starting FDB server on 172.17.0.2:4500
FDBD joined cluster.
^C
[root@8d6f4438923e /]# exit

docker run -ti --platform=linux/amd64 --entrypoint=bash -v $(pwd)/:/fdb foundationdb/foundationdb:7.1.26
[root@699567e0b323 /]# sed -i '$ s/$/ --knob_disable_posix_kernel_aio=1/' /var/fdb/scripts/fdb.bash; /var/fdb/scripts/fdb.bash
Starting FDB server on 172.17.0.2:4500
/var/fdb/scripts/fdb.bash: line 68: 26 Illegal instruction fdbserver --listen-address 0.0.0.0:"$FDB_PORT" --public-address "$PUBLIC_IP:$FDB_PORT" --datadir /var/fdb/data --logdir /var/fdb/logs --locality-zoneid="$(hostname)" --locality-machineid="$(hostname)" --class "$FDB_PROCESS_CLASS" --knob_disable_posix_kernel_aio=1
[root@699567e0b323 /]# exit

```

Unfortunately, `7.1.24` does not have the `.pkg` client library download for `arm64`.  
Is anybody able to run 7.1.26 or higher on an m2?

---

<div class="post-metadata">

**Author:** ![atn34](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/atn34/32/617_2.png) [@atn34](https://forums.foundationdb.org/u/atn34)\
**Post date:** [April 24, 2023, 5:41pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/8 "2023-04-24T17:41:19Z")

</div>

FWIW things seem to work ok outside docker. On my m1 I downloaded and installed [https://github.com/apple/foundationdb/releases/download/7.1.31/FoundationDB-7.1.31\_arm64.pkg](https://github.com/apple/foundationdb/releases/download/7.1.31/FoundationDB-7.1.31_arm64.pkg), downloaded [https://repo1.maven.org/maven2/org/foundationdb/fdb-java/7.1.31/fdb-java-7.1.31.jar](https://repo1.maven.org/maven2/org/foundationdb/fdb-java/7.1.31/fdb-java-7.1.31.jar), and was able to run the example code from [Overview (FoundationDB Java Client API)](https://apple.github.io/foundationdb/javadoc/index.html).

```auto
$ cat Example.java
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDB;
import com.apple.foundationdb.tuple.Tuple;

public class Example {
  public static void main(String[] args) {
    FDB fdb = FDB.selectAPIVersion(710);

    try(Database db = fdb.open()) {
      // Run an operation on the database
      db.run(tr -> {
        tr.set(Tuple.from("hello").pack(), Tuple.from("world").pack());
        return null;
      });

      // Get the value of 'hello' from the database
      String hello = db.run(tr -> {
        byte[] result = tr.get(Tuple.from("hello").pack()).join();
        return Tuple.fromBytes(result).getString(0);
      });

      System.out.println("Hello " + hello);
    }
  }
}

$ javac -cp fdb-java-7.1.31.jar:. Example.java

$ java -cp fdb-java-7.1.31.jar:. Example
Hello world

$ fdbcli --exec 'getrange "" \xff'

Range limited to 25 keys
`\x02hello\x00' is `\x02world\x00'

```

---

<div class="post-metadata">

**Author:** ![ashurpin](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ashurpin/32/1744_2.png) [@ashurpin](https://forums.foundationdb.org/u/ashurpin)\
**Post date:** [January 30, 2024, 11:02am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/9 "2024-01-30T11:02:47Z")

</div>

I had exactly the same problems with the official docker images. I also found that after version 7.1.24, all images cause the `Illegal instruction` error. For both `Qemu` and `Mac OS Virtualization Framework`.

I made a prototype of a native arm64 container build based on Fedora 40. @mping-exo you can take my code [here](https://github.com/SlamJam/fdb-playground) and use it any way you want.

---

<div class="post-metadata">

**Author:** ![johscheuer](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@johscheuer](https://forums.foundationdb.org/u/johscheuer)\
**Post date:** [February 1, 2024, 10:22am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/10 "2024-02-01T10:22:29Z")

</div>

CC @ammolitor are you aware of any changes in the build process that could cause those `Illegal instruction` errors?

---

<div class="post-metadata">

**Author:** ![mping-exo](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/mping-exo/32/1374_2.png) [@mping-exo](https://forums.foundationdb.org/u/mping-exo)\
**Post date:** [February 1, 2024, 11:23am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/11 "2024-02-01T11:23:22Z")

</div>

Thanks alot, I’ll definitely take a look!

---

<div class="post-metadata">

**Author:** ![juvenn](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/juvenn/32/1970_2.png) [@juvenn](https://forums.foundationdb.org/u/juvenn)\
**Post date:** [May 27, 2025, 2:15pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/12 "2025-05-27T14:15:35Z")

</div>

FYI, I’m using latest 7.3.67 image, and encountered the `Illegal instruction` error too.

```auto
docker run --platform linux/amd64 --entrypoint bash --rm -it foundationdb/foundationdb:7.3.67
bash-5.1# echo hello
hello
bash-5.1# ls
afs bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
bash-5.1# uname -a
Linux 0566965631da 6.12.15-orbstack-00304-gd0ddcf70447d #60 SMP Tue Feb 18 19:55:47 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
bash-5.1# fdbserver
Illegal instruction
bash-5.1# fdbserver -v
Illegal instruction
bash-5.1# fdbserver -version
Illegal instruction

```

---

<div class="post-metadata">

**Author:** ![johscheuer](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@johscheuer](https://forums.foundationdb.org/u/johscheuer)\
**Post date:** [May 27, 2025, 4:20pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/13 "2025-05-27T16:20:26Z")

</div>

Since 7.3 FDB releases arm64 binaries. We haven’t updated all our pipelines yet to also release arm64 docker images but thanks to a PR from @gm42 you’re able to build the image by yourself. Just clone the [GitHub - apple/foundationdb: FoundationDB - the open source, distributed, transactional key-value store](https://github.com/apple/foundationdb) locally and run the following commands:

```bash
$ cd packaging/docker
# Update the version if you want and adjust the image name
$ docker build --build-arg FDB_VERSION=7.3.67 -t foundationdb/my-foundationdb:7.3.67 --target=foundationdb .
# Now you can run the image locally
$ docker run -ti docker.io/foundationdb/my-foundationdb:7.3.67
Starting FDB server on 172.17.0.2:4500
FDBD joined cluster.
# use docker exec to exec into the container from another terminal if wanted.

```

---

<div class="post-metadata">

**Author:** ![jon](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/jon/32/1896_2.png) [@jon](https://forums.foundationdb.org/u/jon)\
**Post date:** [September 2, 2025, 3:45pm UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/14 "2025-09-02T15:45:27Z")

</div>

> [@johscheuer](#):
>
> We haven’t updated all our pipelines yet to also release arm64 docker images

Is this a thing where you’d accept an external contribution? My understanding is that you’re referring to (reasonably!) internal, private pipelines, but if that’s not the case, I might be able to help!

---

<div class="post-metadata">

**Author:** ![johscheuer](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@johscheuer](https://forums.foundationdb.org/u/johscheuer)\
**Post date:** [September 8, 2025, 10:59am UTC](https://forums.foundationdb.org/t/foundationdb-on-docker-mac-m2/3876/15 "2025-09-08T10:59:06Z")

</div>

> Is this a thing where you’d accept an external contribution? My understanding is that you’re referring to (reasonably!) internal, private pipelines, but if that’s not the case, I might be able to help!

Those pipelines are private, so sadly we cannot accept any features from the community.
