I am building a python docker image and am testing out the kinit capability. When I run the following `os.system('kinit') I am receiving an error
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 Requirements:
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 code:
import ssl from impala.dbapi import connect import os os.system("kinit") I get the error sh: 1: kinit: not found
1 Answer
The kinit Debian package is not-related to Kerberos:
# apt-cache search kinit kinit - process launcher to speed up launching KDE applications kinit-dev - process launcher to speed up launching KDE applications The package that contains the /usr/bin/kinit binary is the krb5-user package:
# dpkg -S /usr/bin/kinit krb5-user: /usr/bin/kinit # apt-cache search krb5-user krb5-user - basic programs to authenticate using MIT Kerberos Your Dockerfile should look like this:
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 Note: krb5-user installation is interactive, you need to set DEBIAN_FRONTEND=noninteractive to make it unattended.