I'm trying to execute the following bash command as a Google Cloud Run Job from the Google Cloud Console: dbt run -s tag:client
.
For that, I'm passing container arguments, while keeping the entrypoint untouched:
I've pushed the following Dockerfile to Artifact Registry for that:
FROM python:3.11
ENV PYTHONUNBUFFERED=True
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . /code/
RUN dbt deps
ENTRYPOINT ["dbt"]
Executing docker run
locally works fine:
docker run \
data-warehouse-2 \
run -s tag:client
However, when I pass the following arguments to the Cloud Run Job:
args:
- run
- -s
- tag:client
I get the error
terminated: Application failed to start: "/usr/local/bin/dbt": exec format error
I've tried with many different entrypoints and different combinations of the args:
ENTRYPOINT ["sh", "-c", "dbt \"$@\"", "--"]
ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/bin/bash", "dbt"]
And none of them work. How can I run the desired command as a Cloud Run Job?
Just making sure, are you using an ARM based machine (M1)? If so, refer to the following official documents:
Note: If you build your container image on a ARM based machine, then it might not work as expected when used with Cloud Run. To solve this issue, build your image using Cloud Build.
Supported languages and images
Executables in the container image must be compiled for Linux 64-bit. Cloud Run specifically supports the Linux x86_64 ABI format.
You should build your Docker container with the --platform linux/amd64
flag before deploying the image to Cloud Run:
docker buildx build --platform linux/amd64 -t image-name:v1.1 .
You can find similar answers in post1 & post2 for more details.