我正在构建一个python docker映像并正在测试kinit功能。当我运行以下`os.system('kinit')时,我收到一个错误
FROM python:3.5.7-buster
ADD krb5.conf /etc/krb5.conf
ADD krb5.keytab /etc/krb5.keytab
COPY requirements.txt .
RUN apt-get update && apt-get install -y libsasl2-dev libsasl2-2 libsasl2-modules-gssapi-mit openssl libkrb5-dev krb5-config kinit kinit-dev
RUN pip install --no-cache-dir -r requirements.txt
要求:
impyla==0.15.0 sasl==0.2.1 thrift_sasl==0.2.1 thriftpy==0.3.9 thriftpy2==0.4.0 numpy pandas openssl-python==0.1.1 kerberos
Python代码:
import ssl
from impala.dbapi import connect
import os
os.system("kinit")
我收到错误sh: 1: kinit: not found
答案 0 :(得分:3)
kinit
Debian软件包与Kerberos不相关:
# apt-cache search kinit
kinit - process launcher to speed up launching KDE applications
kinit-dev - process launcher to speed up launching KDE applications
包含/usr/bin/kinit
二进制文件的软件包是krb5-user
软件包:
# dpkg -S /usr/bin/kinit
krb5-user: /usr/bin/kinit
# apt-cache search krb5-user
krb5-user - basic programs to authenticate using MIT Kerberos
您的Dockerfile应该如下所示:
FROM python:3.5.7-buster
ADD krb5.conf /etc/krb5.conf
ADD krb5.keytab /etc/krb5.keytab
COPY requirements.txt .
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y libsasl2-dev libsasl2-2 libsasl2-modules-gssapi-mit openssl libkrb5-dev krb5-config krb5-user
RUN pip install --no-cache-dir -r requirements.txt
注意:krb5-user
安装是交互式的,您需要将DEBIAN_FRONTEND=noninteractive
设置为make it unattended。