M1 Macbook Pro Docker Issue Gradle and JDK

Viewed 1950

Docker is giving this error no idea what to do with it on M1 mac, how do I utilize virtualization in this case? Other docker images have been built successfully except for gradle.

Building platform
[+] Building 1.9s (5/5) FINISHED                                                                                                                                            
 => [internal] load build definition from Dockerfile                                                                                                                   0.4s
 => => transferring dockerfile: 37B                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                      0.5s
 => => transferring context: 2B                                                                                                                                        0.0s
 => CANCELED [internal] load metadata for docker.io/library/java:8                                                                                                     1.2s
 => ERROR [internal] load metadata for docker.io/library/gradle:4.7.0-jdk8-alpine                                                                                      1.2s
 => [auth] library/gradle:pull token for registry-1.docker.io                                                                                                          0.0s
------
 > [internal] load metadata for docker.io/library/gradle:4.7.0-jdk8-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:588dcfb0c01babf0ed3989462f13600567e8c5325ea746122dea10717d0a7676: not found
ERROR: Service 'platform' failed to build

1 Answers

Gradle version 4.7 is too old to support ARM. You will need to update it to at least Gradle v6.6.

Inspecting the docker manifest for Gradle v4.7 shows only amd64 support:

% docker manifest inspect gradle:4.7
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2630,
         "digest": "sha256:ac443afe3db5345443498323b231ebb24957db6eb9f60810e5a130ee0bfb816e",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      }
   ]
}

The first Gradle version to support arm64 is v6.6:

% docker manifest inspect gradle:6.6
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2002,
         "digest": "sha256:3ead37e1c04f2e5e8c7a62d9f2d66fb8bc407e3bb5add60ced374ed1fd856384",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2001,
         "digest": "sha256:e73b629a0d1266be3a8a2f07f0247a4ad216999d4ea116c63d60abf65cded9a6",
         "platform": {
            "architecture": "arm",
            "os": "linux",
            "variant": "v7"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2002,
         "digest": "sha256:bd2e6141429a2c6a365637fe93c0c57908dda4c775fe4ca0d1e05b3019602fec",
         "platform": {
            "architecture": "arm64",
            "os": "linux",
            "variant": "v8"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2002,
         "digest": "sha256:2db090296416298ffc96fc9e75a51014976095e14d4445a4e0bfef6df77818cb",
         "platform": {
            "architecture": "ppc64le",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 2001,
         "digest": "sha256:a93a6657249908eb6e4f9cf706649a73016ca0d73c5b6138a8556cea984961b2",
         "platform": {
            "architecture": "s390x",
            "os": "linux"
         }
      }
   ]
}
Related