Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to run cbt import from within a cloud-sdk container

peakit
New Member

Hi, I am trying to run cbt import utility from within a container but it keeps failing with missing instance error.

 

Activated service account credentials for: [my-service-account-sa@my-project1234.iam.gserviceaccount.com]
Updated property [core/project].
2024/12/19 19:13:22 -project flag unset, will use gcloud active project
2024/12/19 19:13:23 gcloud active project is "my-project1234"
2024/12/19 19:13:23 missing -instance
1

 

My dockerfile is as below:

FROM google/cloud-sdk:latest

COPY service_account_key.json /service_account_key.json
COPY test.csv /test.csv

ENV GOOGLE_CLOUD_PROJECT=my-project1234
ENV BIGTABLE_INSTANCE_ID=test123
ENV GOOGLE_APPLICATION_CREDENTIALS=/service_account_key.json

# Ensure cbt is in the PATH (Important!)
ENV PATH="${PATH}:/google-cloud-sdk/bin"

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

And the entrypoint.sh file looks like this:

#!/bin/bash
gcloud auth activate-service-account --key-file="$GOOGLE_APPLICATION_CREDENTIALS"
gcloud config set project "$GOOGLE_CLOUD_PROJECT"
cd /tmp
cbt import --instance="$BIGTABLE_INSTANCE_ID" record /test.csv --column-families=info

echo $?
0 1 109
1 REPLY 1

Hi @peakit,

Welcome to the Google Cloud Community!

Based on the cbt CLI reference, could you check if changing “cbt import --instance" to “cbt import -instance” resolves the issue? (basically remove the extra dash)

We can also try replicating the issue by creating another test instance, then import that instead. If you get the same error, try reinstalling the cbt CLI.

Was my response helpful? If so, feel free to accept this answer as “Solution”. If you need any additional assistance you may also reply here within two business days. Share your logs, screenshots, or any additional errors you might have received and I’ll be happy to help.