Deploy Presto with Docker

This guide explains how to install and get started with Presto using Docker.

Note

These steps were developed and tested on Mac OS X, on both Intel and Apple Silicon chips.

Prepare the container environment

If Docker is already installed, skip to step 4 to verify the setup. Otherwise, follow the instructions below to install Docker and Colima using Homebrew or choose an alternative method.

  1. Install Homebrew if it is not already present on the system.

  2. Install the Docker command line and Colima tools via the following command:

    brew install docker colima
    
  3. Run the following command to start Colima with defaults:

    colima start
    

    Note

    The default VM created by Colima uses 2 CPUs, 2GiB memory and 100GiB storage. To customize the VM resources, see the Colima README for Customizing the VM.

  4. Verify the local setup by running the following command:

    docker run hello-world
    

    The following output confirms a successful installation.

    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    

Installing and Running the Presto Docker container

  1. Download the latest non-edge Presto container from Presto on DockerHub:

    docker pull prestodb/presto:latest
    

    Downloading the container may take a few minutes. When the download completes, go on to the next step.

  2. On the local system, create a file named config.properties containing the following text:

    coordinator=true
    node-scheduler.include-coordinator=true
    http-server.http.port=8080
    discovery-server.enabled=true
    discovery.uri=http://localhost:8080
    
  3. On the local system, create a file named jvm.config containing the following text:

    -server
    -Xmx2G
    -XX:+UseG1GC
    -XX:G1HeapRegionSize=32M
    -XX:+UseGCOverheadLimit
    -XX:+ExplicitGCInvokesConcurrent
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:+ExitOnOutOfMemoryError
    -Djdk.attach.allowAttachSelf=true
    
  4. To start the Presto server in the Docker container, run the command:

    docker run -p 8080:8080 -it -v ./config.properties:/opt/presto-server/etc/config.properties -v ./jvm.config:/opt/presto-server/etc/jvm.config --name presto prestodb/presto:latest
    

    This command assigns the name presto for the newly-created container that uses the downloaded image prestodb/presto:latest.

    The Presto server logs startup information in the terminal window. The following output confirms the Presto server is running in the Docker container.

    ======== SERVER STARTED ========
    

Removing the Presto Docker container

To stop and remove the Presto Docker container, run the following commands:

docker stop presto
docker rm presto

These commands return the name of the container presto when they succeed.