gpt4 book ai didi

运行 os.system ("kinit"时的 Python 错误)- sh : 1: kinit: not found

转载 作者:太空宇宙 更新时间:2023-11-04 11:09:15 53 4
gpt4 key购买 nike

我正在构建一个 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

最佳答案

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=noninteractivemake it unattended .

关于运行 os.system ("kinit"时的 Python 错误)- sh : 1: kinit: not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58697203/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com