Build Docker image for DRILL 1.12 sqlline client
Aim:
To build a docker image for DRILL sqlline client.
Prerequisites:
[1] Docker installed, up and running.
[2] Download the following jars:
[a] drill-jdbc-all-1.12.0.jar (http://central.maven.org/maven2/org/apache/drill/exec/drill-jdbc-all/1.12.0/drill-jdbc-all-1.12.0.jar)
[b] jline-2.10.jar (http://central.maven.org/maven2/jline/jline/2.10/jline-2.10.jar)
[c] sqlline-1.1.9-drill-r7.jar (http://repository.mapr.com/nexus/content/repositories/drill/sqlline/sqlline/1.1.9-drill-r7/sqlline-1.1.9-drill-r7.jar)
Creating Dockerfile:
[1] Create a folder. Let's call it drill-sqlline.
[2] Copy above 3 jars to drill-sqlline directory.
[3] Create a text file 'sqlline' with the following content:
java -cp "/jars/drill-jdbc-all-1.12.0.jar:/jars/sqlline-1.1.9-drill-r7.jar:/jars/jline-2.10.jar" sqlline.SqlLine -d org.apache.drill.jdbc.Driver
[4] Create a 'Dockerfile' inside drill-sqlline with the following content:
FROM centos:latest RUN yum install java-devel -y RUN mkdir /jars ADD drill-jdbc-all-1.12.0.jar /jars/ ADD jline-2.10.jar /jars/ ADD sqlline-1.1.9-drill-r7.jar /jars/ ADD sqlline / RUN chmod +x /sqlline
Directory 'drill-sqlline' will contain:
Dockerfile
drill-jdbc-all-1.12.0.jar
jline-2.10.jar
sqlline
sqlline-1.1.9-drill-r7.jar
[5] Execute the following command in 'drill-sqlline' directory:
docker build -t jamealwi/drill-sqlline:latest .
(NOTE: Make sure you use your docker hub username instead of 'jamealwi')
[root@vmdocc7176 sqlline-docker]# docker build -t jamealwi/drill-sqlline:latest . Sending build context to Docker daemon 28.12 MB Step 1 : FROM centos:latest ---> 2d194b392dd1 Step 2 : RUN yum install java-devel -y ---> Using cache ---> 9928f31bf455 Step 3 : RUN mkdir /jars ---> Using cache ---> e0a46e253ebc Step 4 : ADD drill-jdbc-all-1.12.0.jar /jars/ ---> Using cache ---> d977165bcb13 Step 5 : ADD jline-2.10.jar /jars/ ---> Using cache ---> 27e0cbb67ab7 Step 6 : ADD sqlline-1.1.9-drill-r7.jar /jars/ ---> Using cache ---> 229c77630c35 Step 7 : ADD sqlline / ---> Using cache ---> c3545c155a61 Step 8 : RUN chmod +x /sqlline ---> Using cache ---> 62d1cbe78611 Step 9 : CMD ./sqlline ---> Using cache ---> 9f7c6cb3b3e9 Successfully built 9f7c6cb3b3e9 [root@vmdocc7176 sqlline-docker]#
(NOTE: You will see way more messages if you are building the image for the first time.)
Your docker image for DRILL sqlline is ready!
The docker image is available in my docker hub. You can pull the image using the following command:
docker pull jamealwi/drill-sqlline
Now you can run your Docker image by the following command:
docker exec -it jamealwi/drill-sqlline bash
Once you are inside the container, execute './sqlline'.
No comments:
Post a Comment