To build an Apache Drill docker image, you need to have the following software installed on your system to successfully complete a build.
If you are using an older Mac or PC, additionally configure docker-machine on your system
Drill has two Dockerfiles:
$ git clone https://github.com/apache/drill.git
$ cd drill $ mvn clean install
To build a Docker image tagged with the current project version using dockerfile maven plugin using pre-built Drill, the following command may be used:
$ mvn dockerfile:build -Pdocker -pl distribution
By default, the docker image built above is configured to be pushed to Drill Docker Hub. Please do not push images manually since it should be done using automated builds in DockerHub.
$ mvn dockerfile:push -Pdocker -pl distribution
You can configure the repository in pom.xml
to point to any private or public container registry, or specify it in your mvn command.
$ mvn dockerfile:push -Pdocker -Ddocker.repository=<my_repo> -pl distribution
Running the Docker container should start Drill in embedded mode and connect to Sqlline.
$ docker run --rm -i --name drill-1.17.0 -p 8047:8047 -t apache/drill:1.17.0 /bin/bash Apache Drill 1.17.0 "JSON ain't no thang." apache drill> select version from sys.version; +---------+ | version | +---------+ | 1.17.0 | +---------+ 1 row selected (1.65 seconds)
You can also run the container in detached mode and connect to sqlline using drill-localhost.
$ docker run -i --name drill-1.17.0 -p 8047:8047 --detach -t apache/drill:1.17.0 /bin/bash <displays container ID> $ docker exec -it drill-1.17.0 bash <connects to container> $ /opt/drill/bin/drill-localhost Apache Drill 1.17.0 "JSON ain't no thang." apache drill> select version from sys.version; +---------+ | version | +---------+ | 1.17.0 | +---------+ 1 row selected (1.65 seconds)
By default, you can only query files which are accessible within the container. For example, the sample data which ships with Drill.
> select first_name, last_name from cp.`employee.json` limit 1; +-------------+------------+ | first_name | last_name | +-------------+------------+ | Sheri | Nowmer | +-------------+------------+ 1 row selected (0.256 seconds)
To query files outside of the container, you can configure docker volumes
Drill web UI can be accessed using http://localhost:8047 once the Drill docker container is up and running. On Windows, you may need to specify the IP address of your system instead of ‘localhost’.
Autobuild triggers a new build to Drill Docker Hub with every git push to Apache master repository or when new tags are added. It uses Dockerfile from project root directory which builds Drill when building docker image.
For more information including how to run Apache Drill in a Docker container, visit the Apache Drill Documentation