Issue with Installing AlloyDB Omni CLI via Dockerfile Due to Architecture Mismatch

354 views Asked by At

I'm attempting to set up AlloyDB Omni locally using a Dockerfile following the guidelines provided in the official Google documentation.

Below is the Dockerfile configuration I'm using:

FROM ubuntu:latest

# Install necessary packages and dependencies
RUN apt-get update && apt-get install -y \
    software-properties-common \
    sudo \
    curl \
    gnupg \
    && rm -rf /var/lib/apt/lists/*

# Add AlloyDB repository
RUN curl https://europe-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add -
RUN echo "deb [arch=amd64] https://europe-apt.pkg.dev/projects/alloydb-omni alloydb-omni-apt main" | sudo tee -a /etc/apt/sources.list.d/artifact-registry.list

# Update repositories and install alloydb-cli
RUN apt-get update && apt-get install -y alloydb-cli

However, during the Docker build process, the installation fails with the error:

Unable to locate package alloydb-cli

Upon further investigation, I found a log entry indicating:

Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'https://europe-apt.pkg.dev/projects/alloydb-omni alloydb-omni-apt InRelease' doesn't support architecture 'arm64'

It seems that AlloyDB Omni CLI supports the AMD64 architecture, but I'm working on an ARM architecture, causing this installation issue.

I'm seeking guidance or potential workarounds to overcome this architectural mismatch. My ultimate objective is to create a Dockerfile that can set up AlloyDB locally, similar to setting up other databases like PostgreSQL. However, since AlloyDB doesn't offer official Docker images, I'm attempting to build one myself and encountered this hurdle.

Any insights or suggestions on how to resolve this issue within the Dockerfile would be greatly appreciated. Thank you!

EDIT: Managed to build this using:

docker build --platform linux/amd64 -t alloydb-docker-in-docker .

Since alloyDB Omni requires Docker to be available, next step was to setup this image with Docker-Inside-Docker setup and added following lines to my dockerfile:

RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
RUN apt-get update && sudo apt-get -y install docker-ce

Next step was to run the image with privileged mode like so:

docker run --privileged -it --name alloydb-dind alloydb-docker-in-docker /bin/bash

When execing into the container alloyDB is available, so is Docker (docker ps and managed to actually run hello-world docker container inside the docker image. When running alloydb system-check it says docker not available (not sure what do they do to check docker installation).

enter image description here

At the end of the day decided to drop this local setup until we get official docker image from AlloyDB Omni prepared cuz this all seems a little bit too hacky to setup, especially with docker-inside-docker which is complicated as is to begin with.

2

There are 2 answers

3
Boris BRESCIANI On

You can replace

FROM ubuntu:latest

to

FROM --platform=linux/amd64 ubuntu:latest
0
ddotsenko On

Google's AlloyDB Omni is actually several services orchestrated together.

alloydb-cli is an installer that sets up several systemd services. It is not the actual server binary. So, trying to dockerize it will not get you what you want - a single image like one for postgres.

For containerized deploy of AlloyDB Omni see the Kubernetes deploy docs https://cloud.google.com/alloydb/docs/omni/deploy-kubernetes

AlloyDB Omni binaries are spread over several images: gcr.io/alloydb-omni/operator/local-operator:0.4.0 gcr.io/alloydb-omni/operator/fleet-operator:0.4.0 gcr.io/alloydb-omni/operator/dbinit:0.4.0 gcr.io/alloydb-omni/pg-service:15.5.0 gcr.io/alloydb-omni/operator/logrotate:0.4.0 gcr.io/alloydb-omni/memory-agent:15.5.0 etc