Skip to content

duckdb/duckdb-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

DuckDB CLI for Docker

Docker image of DuckDB

$ docker pull duckdb/duckdb:latest

Usage

Pull the latest image

$ docker pull duckdb/duckdb:latest

Specify the version to pull

$ docker pull duckdb/duckdb:1.4.0

Interactive

Running duckdb command inside the container interactively.

$ docker run --rm -it -v "$(pwd):/workspace" -w /workspace duckdb/duckdb
DuckDB v1.4.0 (Andium) b8a06e4a22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D .open ./sample.db
D CREATE TABLE table_sample(timestamp TIMESTAMP, description TEXT);
D INSERT INTO table_sample VALUES(NOW(),'First sample data. Foo');
D INSERT INTO table_sample VALUES(NOW(),'Second sample data. Bar');
D FROM table_sample;
┌─────────────────────────┬─────────────────────────┐
│        timestamp        │       description       │
│        timestamp        │         varchar         │
├─────────────────────────┼─────────────────────────┤
│ 2025-09-15 12:17:00.387 │ First sample data. Foo  │
│ 2025-09-15 12:17:11.407 │ Second sample data. Bar │
└─────────────────────────┴─────────────────────────┘
D .quit
$ ls
sample.db
  • Note that you need to mount the working directory as a volume to the container.

Tip

For Windows users, use %cd% or ${PWD} instead of $(pwd).

  • cmd.exe: docker run --rm -it -v "%cd%:/workspace" -w /workspace duckdb/duckdb
  • PowerShell: docker run --rm -it -v "${PWD}:/workspace" -w /workspace duckdb/duckdb

Command

  • Running duckdb --version command:
$ docker run --rm duckdb/duckdb duckdb --version
v1.4.0 (Andium) b8a06e4a22
  • Executing SQL query to the mounted database:
$ ls
sample.db
$ docker run --rm -it -v "$(pwd):/workspace" duckdb/duckdb duckdb /workspace/sample.db -header -column 'SELECT rowid, * FROM table_sample;'
rowid  timestamp                description            
-----  -----------------------  -----------------------
0      2025-09-15 12:17:00.387  First sample data. Foo 
1      2025-09-15 12:17:11.407  Second sample data. Bar
  • Note that you need to mount the working directory as a volume to the container.

Note: This overview was adapted from the sqlite docker file: https://github.com/KEINOS/Dockerfile_of_SQLite3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published