Search code examples
dockerdockerfilekerberosdevops

How to install kerberos client in docker?


I am trying to create Docker image by next Dockerfile. It must to install Kerberos client.

Dockerfile:

FROM node:latest

RUN export DEBIAN_FRONTEND=noninteractive

RUN apt-get -qq update
RUN apt-get -qq install krb5-user libpam-krb5
RUN apt-get -qq clean

COPY / ./

EXPOSE 3000

CMD ["npm", "start"]

Next command RUN apt-get -qq install krb5-user libpam-krb5 from Dockerfile ask me to enter the value to interactive prompt which looks like:

Default Kerberos version 5 realm: 

The point is that the command does not terminate even if I write value and press enter. Whats wrong and how to fix it?


Solution

  • You need the -y parameter for the apt

    FROM node:latest
    
    ENV DEBIAN_FRONTEND=noninteractive
    
    RUN apt-get -qq update && \
        apt-get -yqq install krb5-user libpam-krb5 && \
        apt-get -yqq clean
    
    COPY / ./
    
    EXPOSE 3000
    
    CMD ["npm", "start"]
    

    And pay attention, that each RUN directive creates one additional layer in the image. That means, your clean command will create a new layer, but all package cache will remain in other layers. So reducing the amount of these directives will be nice. It would help you to shrink the image size.