Image builds fail on new MacBook despite working fine on prior apple silicon

I just got a new MacBook and have been struggling with getting Docker Desktop to function after installing.

I had it on my previous M1 and it worked like a charm, but on my new M4 docker desktop starts up but containers are failing to build and run.

I stripped it down to a simple Dockerfile

FROM maven:3.9-eclipse-temurin-23

RUN mvn -v

And even with this its consistently failing to build with the following error.

% docker build .                                                   
[+] Building 0.4s (5/5) FINISHED                                                                                                                                                                                                          docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                      0.0s
 => => transferring dockerfile: 480B                                                                                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/maven:3.9-eclipse-temurin-23                                                                                                                                                                           0.2s
 => [internal] load .dockerignore                                                                                                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                                                                                                           0.0s
 => CACHED [1/2] FROM docker.io/library/maven:3.9-eclipse-temurin-23@sha256:323693fcac06d3c25f430032884273307a5c37663e7d54506b5096047b380cdd                                                                                                              0.0s
 => ERROR [2/2] RUN mvn -v                                                                                                                                                                                                                                0.2s
------                                                                                                                                                                                                                                                         
 > [2/2] RUN mvn -v:                                                                                                                                                                                                                                           
0.107 #                                                                                                                                                                                                                                                        
0.107 # A fatal error has been detected by the Java Runtime Environment:                                                                                                                                                                                       
0.107 #                                                                                                                                                                                                                                                        
0.107 #  SIGILL (0x4) at pc=0x0000ffff879401a8, pid=6, tid=21                                                                                                                                                                                                  
0.107 #
0.107 # JRE version:  (23.0.1+11) (build )
0.107 # Java VM: OpenJDK 64-Bit Server VM (23.0.1+11, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
0.107 # Problematic frame:
0.107 # j  java.lang.System.registerNatives()V+0 java.base@23.0.1
0.107 #
0.107 # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
0.107 #
0.107 # An error report file with more information is saved as:
0.107 # //hs_err_pid6.log
0.110 [0.014s][warning][os] Loading hsdis library failed
0.113 #
0.113 # The crash happened outside the Java Virtual Machine in native code.
0.113 # See problematic frame for where to report the bug.
0.113 #
0.114 Aborted
------
Dockerfile:4
--------------------
   2 |     FROM maven:3.9-eclipse-temurin-23
   3 |     
   4 | >>> RUN mvn -v
   5 |     
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c mvn -v" did not complete successfully: exit code: 134

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/rg2w9f1d0ghaiht730odrl53i

I uninstalled and reinstalled being sure to select apple silicon as the download. I even reset the Mac and started from scratch but it’s behaving the same after a full reset. I compared the docker info between my old laptop and new and it looks identical besides my old one having a swarm started.

Its throwing a similar error when trying to run springboot containers that again work on my old apple silicon laptop.

Any ideas on what the issue could be? Any insight or troubleshooting steps would be greatly appreciated.

Docker Info Output:

docker info
Client:
 Version:    27.4.0
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Ask Gordon - Docker Agent (Docker Inc.)
    Version:  v0.5.1
    Path:     /Users/xxx/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.19.2-desktop.1
    Path:     /Users/xxx/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.31.0-desktop.2
    Path:     /Users/xxx/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.37
    Path:     /Users/xxx/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Beta) (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/xxx/.docker/cli-plugins/docker-desktop
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /Users/xxx/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.27
    Path:     /Users/xxx/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     /Users/xxx/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /Users/xxx/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/xxx/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.15.1
    Path:     /Users/xxx/.docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 27.4.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 472731909fa34bd7bc9c087e4c27943f9835f111
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.10.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 14
 Total Memory: 15.6GiB
 Name: docker-desktop
 ID: fa25b281-9420-485c-a274-33a2e43dbd7f
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///Users/xxx/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Have you tried running the mvn command in a running container without building an image?
Or changing the Virtual Machine Manager in the general settings (QEMU, Apple Virtualization Framework, Docker VMM)?

Maven from a running container also fails with the following

docker run -it maven:3.9-eclipse-temurin-23 /bin/bash
root@3cf735b82962:/# mvn -X -v
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000ffff6b9401a8, pid=112, tid=127
#
# JRE version:  (23.0.1+11) (build )
# Java VM: OpenJDK 64-Bit Server VM (23.0.1+11, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# j  java.lang.System.registerNatives()V+0 java.base@23.0.1
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# //hs_err_pid112.log
[0.015s][warning][os] Loading hsdis library failed
#
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted

Trying to change from Apple Virtualization to Docker VMM now…

VMM behaved the same, when switching to QEMU docker threw this error

running engine: waiting for the Docker API: engine linux/qemu failed to run: running VM: qemu: process terminated unexpectedly: exit status 1

I recommend opening an issue on GitHub

There are some M3 and M4 related issues already, but yours seems to be different. I only have M1, so I can’t test it.

Thanks @rimelek - a reddit response actually pointed me to this one.

Looks like it’s a java bug specific to M4/Docker/MacOs 15.2. Really appreciate you taking a look, for now the recommended workaround of using JAVA_OPTS=“-XX:UseSVE=0” seems to be working.

1 Like

Hi @rimelek ,
I tested on M3 its working fine. also compared with docker info seems almost same. @benferenchak check if you are using M4.

sandip@Sandips-MacBook-Air apps % docker run -it maven:3.9-eclipse-temurin-23 /bin/bash
root@1f2b2396d3e7:/# mvn -v
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /usr/share/maven
Java version: 23.0.1, vendor: Eclipse Adoptium, runtime: /opt/java/openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.10.4-linuxkit", arch: "aarch64", family: "unix"
root@1f2b2396d3e7:/# exit

There is no need to check that

And the link also points to an issue on M4.

Yep all good here, thanks again!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.