drill icon indicating copy to clipboard operation
drill copied to clipboard

run the Drill Docker container in detached mode will exit automatically

Open luoxiaohi opened this issue 2 years ago • 5 comments

Drill version latest (1.21.1)

Describe the bug I am following the doc running drill in docker.

To Reproduce I want to run the Drill Docker container in detached mode, so I run this command:

docker run --name drill -p 8047:8047 -p 31010:31010 --detach apache/drill

as stated in the document, but the container exits automatically a few seconds later.

Then, I try to run the Drill Docker Container in Foreground Mode:

docker run -it --name drill  -p 8047:8047 -p 31010:31010 apache/drill 

It starts correctly, but when I run $DRILL_HOME/bin/drill-embedded in the container, the container exits too, and it logs

apache drill> Killed

so I think maybe the problem lies in $DRILL_HOME/bin/drill-embedded this command.

luoxiaohi avatar Aug 29 '23 08:08 luoxiaohi

@luoxiaohi It seems that you can add -it to start in detached mode to prevent it from quitting after a while. docker run -it --name drill -p 8047:8047 -p 31010:31010 --detach apache/drill

maharjanraj avatar Mar 20 '24 06:03 maharjanraj

Would someone mind submitting a pull request to update the docs with this?Sent from my iPhoneOn Mar 20, 2024, at 02:33, Raj Krishna Maharjan @.***> wrote: @luoxiaohi It seems that you can add -it to start in detached mode to prevent it from quitting after a while. docker run -it --name drill -p 8047:8047 -p 31010:31010 --detach apache/drill

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

cgivre avatar Mar 20 '24 11:03 cgivre

Can we not add a command line argument to drill-embedded itself to not quit? Adding -it isn't practical in a variety of situations, including Docker Compose.

sklibanov312 avatar Mar 20 '24 12:03 sklibanov312

I've worked around this with a custom Dockerfile:

FROM debian:12

# We're going to be installing things
RUN apt-get update

# Here's some basic conveniences, and Java because Drill runs on that
RUN apt-get install -y ca-certificates curl net-tools bind9-utils dos2unix less procps expect default-jre

# Create a non-root user and switch to it
RUN groupadd -r drill
RUN useradd --no-log-init -r -g drill -m drill

WORKDIR /home/drill

COPY ./apache-drill-1.21.1.tar.gz /home/drill
COPY ./docker-entrypoint.sh /home/drill
RUN chown -R drill:drill /home/drill

USER drill

RUN tar xvfz apache-drill-1.21.1.tar.gz
RUN chmod u+rwx /home/drill/docker-entrypoint.sh

# In case your host is Windows...
RUN dos2unix /home/drill/docker-entrypoint.sh

CMD ["/home/drill/docker-entrypoint.sh"]

The docker-entrypoint.sh has this:

#!/bin/bash

# The 'unbuffer' part is a workaround for https://github.com/apache/drill/issues/2829
unbuffer apache-drill-1.21.1/bin/drill-embedded

With port 8047 forwarded I can still talk to it thru the web page.

So that's the workaround. Now I can run this in a docker compose stack or whatever, without having to add -ti.

sklibanov312 avatar Apr 30 '24 02:04 sklibanov312

@sklibanov312

I tried your solution and it is working perfectly you saved my life!! Thanks!

yahias123hawkyy avatar Jun 17 '24 15:06 yahias123hawkyy