hive-metastore-docker icon indicating copy to clipboard operation
hive-metastore-docker copied to clipboard

Compatibility on Apple ARM CPUs (M1, M2, ..)

Open AydinChavez opened this issue 2 years ago • 1 comments

Hi,

thanks for this great work!

It did not run on my M2 Mac due to the usage of a non-ARM compatible Java8 base image, therefore I wanted to share my solution for others:

Dockerfile:

#FROM openjdk:8u242-jre <- comment this out and add next line
FROM arm64v8/openjdk:8
..

The bucket spark was not existing in minio initially and also its web UI was not reachable (because of its listening port being randomly chosen), therefore I added following tweaks taken from:

  • https://stackoverflow.com/questions/70329649/docker-compose-minio-switches-port-when-viewed-in-browser
  • https://stackoverflow.com/questions/66412289/minio-add-a-public-bucket-with-docker-compose

docker-compose.yml:

version: "2"

services:
  mariadb:
    image: mariadb:latest
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: admin
      MYSQL_USER: admin
      MYSQL_PASSWORD: admin
      MYSQL_DATABASE: metastore_db

  # make sure that you specify correct volume to be mounted
  minio:
    image: minio/minio
    environment:
      - MINIO_ACCESS_KEY=accesskey
      - MINIO_SECRET_KEY=secretkey
    volumes:
      - ./data1/minio:/data
    ports:
      - 9000:9000
      - 9001:9001
    command: server --address ":9000" --console-address ":9001" /data

  createbuckets:
    image: minio/mc
    depends_on:
      - minio
    entrypoint: >
      /bin/sh -c "
      /usr/bin/mc alias set myminio http://minio:9000 accesskey secretkey;
      /usr/bin/mc mb myminio/spark;
      /usr/bin/mc policy set public myminio/spark;
      exit 0;
      "

  hive-metastore:
    build: .
    image: hive-metastore:latest
    ports:
    - 9083:9083
    depends_on:
      - mariadb

AydinChavez avatar Jan 06 '23 22:01 AydinChavez

thanks for reporting this. I do not have M1 mac to test it. I suggest creating a separate Dockerfile for M1 architectures. We can even add makefile to help build docker files. Are you ok to submit PR for this?

arempter avatar Jan 31 '23 07:01 arempter