How to configure Databricks token inside Docker File?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2021 08:48 AM
I have a docker file where I want to
- Download the Databricks CLI
- Configure the CLI by adding a host and token
- And then running a python file that hits the Databricks token
I am able to install the CLI in the docker image, and I have a working python file that is able to submit the job to the Databricks API but Im unsure of how to configure my CLI within docker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2021 11:08 AM
The Databricks cli credential can be configured by editing file ~/.databrickscfg .
The file content will be like below:
[DEFAULT]
host = [workspace url]
username = [email id]
password = [password]
[profile 1]
host = [workspace url]
token = {personal access token}After the Databricks Cli installed succeed, you can append your credential and workspace url to the file ~/.databrickscfg. Then the cli is ready to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 09:16 AM
Hi I was facing same issue and searching for the solution but didnt get it, and now after working on it i have the solution 🙂
if you want to access databricks models/download_artifacts using hostname and access token like how you do on databricks cli
databricks configure --token --profile <profile name>
>Databricks Host (should begin with https://): <hostname>
>Token : <token>if you have created profile name and pushed models and just want to access the model/artifacts in docker using this profile
Add below code in the docker file.
RUN pip install databricks_cli
ARG HOST_URL
ARG TOKEN
RUN echo "[<profile name>]\nhost = ${HOST_URL}\ntoken = ${TOKEN}" >> ~/.databrickscfg#this will created your .databrickscfg file with host and token after build the same way you do using databricks configure command
Add args HOST_URL and TOKEN in the docker build
e.g
your host name = https://adb-5443106279769864.19.azuredatabricks.net/
your access token = dapi********************63c1-2
sudo docker build -t test_tag --build-arg HOST_URL=<your host name> --build-arg TOKEN=<your access token> .And now you can access your experiments using this profilename Databricks:<profile name> in the code.