Start kdc in Dockerfile

420 Views Asked by At

In Dockerfile, I put in the following:

COPY docker-files/krb5.conf /etc
RUN /usr/sbin/krb5kdc -P /var/run/krb5kdc.pid;

Expectation is that KDC would be started when I use "docker run -it" command.

However, KDC is not running after starting docker VM. Was my expectation correct ?

Thanks

2

There are 2 best solutions below

6
On

RUN is not the same as CMD

https://docs.docker.com/engine/reference/builder/#cmd

or

ENTRYPOINT

https://docs.docker.com/engine/reference/builder/#entrypoint

By default a docker container executes what it has in CMD and exits, so that is "normal".

Try replacing RUN by CMD, rebuild and relaunch

See also creack answer in

What is the difference between CMD and ENTRYPOINT in a Dockerfile?

7
On

First, use CMD (takes effect on run time) instead of RUN (takes effect on build time)

Then put krb in foreground with -n:

CMD /usr/sbin/krb5kdc -n -P /var/run/krb5kdc.pid

But if it is still not working, post the docker logs of that container