Deploying your Presto DB UDFs to Presto DB Server in Docker

Rishav Sarkar
2 min readSep 9, 2022

--

In this post we are going to discuss on how to deploy our presto UDF to presto server in a docker container. We need to have our UDF project writen and packaged to a JAR file. More information on creating our Presto UDF can be found here.

Let’s kick things off by setting up our Presto DB container that houses the Presto server. You can execute all the commands listed below directly from the command line or terminal.

First, we would need to install docker on our machine. Once docker is successfully installed in our machine we need to pull the docker image using the command:

For Docker for Mac OS with Apple Silicon:

docker pull prestodb/presto:0.286-edge8-arm64

For Docker for Mac OS with Intel / Docker for Windows:

docker pull prestodb/presto

Once the docker image has been pulled we need to start our presto server using the command:

For Docker for Mac OS with Apple Silicon:

docker run -p 8080:8080 --name prestoDb prestodb/presto:0.286-edge8-arm64

For Docker for Mac OS with Intel / Docker for Windows:

docker run -p 8080:8080 --name prestoDb prestodb/presto

Running this command docker will start our presto server container. Once the docker container is up and running we need to create a folder udfs in the path: /opt/presto-server/plugin/ and copy our UDF jar file to the folder. We can copy the file using the command :

docker cp "<path-to-jar-file>/<jar-name>.jar"  <container-id>:/opt/presto-server/plugin/udfs/

Once the file has been copied, we need to restart the presto server using the command: bin/launcher restart from the presto server or we can simply restart the docker container. Once the docker container is up and running we need to go the presto CLI using the command :

docker exec -it presto presto-cli

Now run the command: show functions; in the presto CLI. This will list all the functions available for presto to use along with our UDFs.

--

--

No responses yet