Apigee Emulator container fails to start on M1 Macbooks

Problem

It seems like the current Apigee Emulator container image (gcr.io/apigee-release/hybrid/apigee-emulator:1.6.1) has not been built by adding support for the ARM64 CPU architecture. As a result, M1 Macbooks use an emulator to run it on ARM64 based CPU architecture and that process is too slow. As a result, the Apigee Emulator container fails to start on M1 Macbooks.

Solution

It seems like this issue has occurred because the Apigee Emulator container image is built for linux/amd64 CPU architecture and M1 Macbook uses an emulator to run it on ARM64 based CPU architecture and that process being slow. Unfortunately, at the moment Apigee has not released an ARM64 based container image for the Apigee Emulator.

In such scenarios, Docker for Mac uses QEmu emulator to run Intel-based container images on M1 Macbooks and that causes a performance degradation mainly due to filesystem notifications being slower: https://docs.docker.com/desktop/mac/apple-silicon/#known-issues

As a result, it takes more time for Cassandra to initialize and the timeout given in the Apigee Emulator elapses before Cassandra gets initialized. Finally, the Apigee Emulator container fails to start.

Docker has done an improvement to resolve this performance issue by using virtiofs (https://virtio-fs.gitlab.io/) and by improving the way that files are synced between the macOS host and Docker VM: https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/

This fix has been released in Docker for Mac 4.6 and macOS 12.2 or above is required to enable this experimental feature. I tried this myself with Docker for Mac 4.8 and it seems to have resolved this problem.

You could also try the following steps to resolve this issue:

  1. Upgrade macOS to 12.2 or above if you have not done so already

  2. Install Docker for Mac 4.6 or above

  3. Enable VirtioFS accelerated directory sharing feature in Docker for Mac

  4. Delete the existing Apigee Emulator container if there is one already and try to execute the below command to start a new container:

    docker run --platform linux/amd64 --name=apigee -p 8080:8080 -p 8998:8998 gcr.io/apigee-release/hybrid/apigee-emulator:1.6.1
    
  5. Verify whether the Apigee Emulator container starts successfully.

Contributors
Comments
davidrush
Staff

Alternatively, if you're using using Colima on macOS Ventura you can specify virtiofs like this:

colima start --mount-type virtiofs --vm-type vz

 

ranomuhamad
Bronze 1
Bronze 1

Docker latest version on mac M1 venturaDocker latest version on mac M1 venturaHi @imesh , I must try your step to resolve this issue, but at docker version 4.28.0, I can't find VirtioFS accelerated directory sharing feature. can you give me another alternative way?

Thanks before.

Version history
Last update:
‎05-18-2022 08:04 PM
Updated by: