apache / drill

Apache Drill is a distributed MPP query layer for self describing data
https://drill.apache.org/
Apache License 2.0
1.93k stars 984 forks source link

run the Drill Docker container in detached mode will exit automatically #2829

Open luoxiaohi opened 11 months ago

luoxiaohi commented 11 months ago

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.

maharjanraj commented 4 months ago

@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

cgivre commented 4 months ago

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: @.***>

sklibanov312 commented 4 months ago

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 commented 3 months ago

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.

yahias123hawkyy commented 1 month ago

@sklibanov312

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