2

我正在尝试编写一个Dockerfile构建一个利用 Databricks Conenect 的容器。RUN因此,我需要通过 Docker命令设置和安装 Databricks Connect 。我有以下内容:

FROM python:3.8
COPY requirements.txt /tmp/
RUN apt-get update\
    && apt-get install software-properties-common -y\
    && apt-get update\
    && apt-add-repository "deb http://security.debian.org/debian-security stretch/updates main"\
    && apt-get update\
    && apt-get install openjdk-8-jdk -y
RUN pip install --requirement /tmp/requirements.txt\
    && databricks-connect configure\
    && databricks-connect test

作为产生我的问题的简化示例。step:databricks-connect configure提示使用 default 接受许可N,因此引发以下错误:

...
#14 1.345 Do you accept the above agreement? [y/N] Traceback (most recent call last):
#14 1.346   File "/usr/local/bin/databricks-connect", line 8, in <module>
#14 1.346     sys.exit(main())
#14 1.346   File "/usr/local/lib/python3.8/site-packages/pyspark/databricks_connect.py", line 281, in main
#14 1.346     configure()
#14 1.346   File "/usr/local/lib/python3.8/site-packages/pyspark/databricks_connect.py", line 119, in configure
#14 1.346     accept = input().strip()
#14 1.346 EOFError: EOF when reading a line
------
executor failed running [/bin/sh -c databricks-connect configure]: exit code: 1

我怎样才能自动接受它作为 Docker 构建的一部分?

4

1 回答 1

0

您需要使用这样的东西(从这个演示中窃取),因为除了接受许可条款外,您还需要提供其他参数:

echo "y
$(databricks_host)
$(databricks_token)
$(cluster_id)
$(org_id)
15001" | databricks-connect configure

或者您可以只生成~/.databricks-connect只是 JSON 的文件:

{
  "host": "https://host",
  "cluster_id": "cluster",
  "org_id": "org_id",
  "port": "15001"
}
于 2021-11-09T19:51:00.160 回答