Run SQL queries against a local Trino instance using Docker
Run SQL queries against a local Trino server using Docker.
trino container exists and is running.docker exec.docker ps --filter "name=trino" --format "{{.Names}}"
If no container exists:
docker run -d -p 8080:8080 --name trino trinodb/trino
If container exists but is stopped (you get a "name already in use" error):
docker start trino
Wait a few seconds for Trino to initialize before running queries.
docker exec trino trino --execute 'SELECT * FROM tpch.tiny.region'
For queries with a specific catalog/schema:
docker exec trino trino --catalog tpch --schema tiny --execute 'SELECT * FROM region LIMIT 10'
Default is aligned columns. For CSV output:
docker exec trino trino --output-format CSV --execute 'SELECT ...'
The default trinodb/trino image includes:
tpch - TPC-H benchmark data (schemas: tiny, sf1, sf10, etc.)tpcds - TPC-DS benchmark datamemory - In-memory tablessystem - System information-- List available catalogs
SHOW CATALOGS;
-- List schemas in tpch
SHOW SCHEMAS FROM tpch;
-- List tables in tpch.tiny
SHOW TABLES FROM tpch.tiny;
-- Sample query
SELECT * FROM tpch.tiny.nation LIMIT 5;
-- Check cluster nodes
SELECT * FROM system.runtime.nodes;
To stop and remove the container:
docker stop trino && docker rm trino
Load this skill when: