Skip to content

About

Start IBM Db2 Community Edition in Docker, create a schema, and practice Db2 SQL and the command line processor.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

ibm-db2-lab

Start IBM Db2 Community Edition in Docker, create a schema, and practice Db2 SQL and the command line processor.

At a glance

Field Detail
Repository ibm-db2-lab
Primary language Mixed / documentation
Topics database, database-labs, devarent, docker, ibm-db2, lab, relational-database, sql
License MIT
Branch main
Maintainer @devarent

Overview

ibm-db2-lab is a hands-on repository focused on: Start IBM Db2 Community Edition in Docker, create a schema, and practice Db2 SQL and the command line processor.. Primary language: Mixed / documentation. Topics: database, database-labs, devarent, docker, ibm-db2, lab, relational-database, sql. The README below documents the project; use the table above for a quick overview.

Global references

🇮🇸 Iceland · 🇳🇿 New Zealand · 🇨🇭 Switzerland · 🇸🇮 Slovenia · 🇮🇪 Ireland · 🇦🇹 Austria · 🇵🇹 Portugal · 🇸🇬 Singapore · 🇫🇮 Finland


ibm-db2-lab LANG multi STARS 0 LICENSE MIT
OPEN SOURCE BUILT IN PUBLIC HANDS ON LABS DOCUMENTED

Start IBM Db2 Community Edition in Docker, create a schema, and practice Db2 SQL and the command line processor.


Arya Fatthurahman

IBM Db2 Lab

Start IBM Db2 Community Edition in Docker, create a schema, and practice Db2 SQL and the command line processor.

Database: IBM Db2 Category: Relational (SQL) Runs in Docker License: MIT compose-check

What this lab is

Db2 is a long-running enterprise relational database with strong SQL standards coverage. This lab runs Db2 Community Edition locally, shows the command line processor workflow, and gives you a schema plus queries that exercise identity columns, CTEs, and Db2-specific syntax.

Quickstart

docker compose up -d
docker compose logs -f db2   # wait for: Setup has completed
docker compose cp examples/01_schema.sql db2:/tmp/01_schema.sql
docker compose exec db2 su - db2inst1 -c 'db2 -tvf /tmp/01_schema.sql'
docker compose exec db2 su - db2inst1 -c 'db2 connect to LAB && db2 "SELECT current_server, current_time FROM sysibm.sysdummy1"'

Connection details

Field Value
Host localhost
Port 50000
Database LAB
User db2inst1
Password db2inst1
JDBC URL jdbc:db2://localhost:50000/LAB
CLP db2 connect to LAB

Examples

File What it shows
docker-compose.yml Engine, ports, and persistent volume.
.github/workflows/compose-check.yml Validates the Compose file on every push.
examples/01_schema.sql Db2 schema with identity columns, constraints, and a summary view.
examples/02_queries.sql Seed data, a CTE, FETCH FIRST, and a window function.

Exercises

  1. Run db2 -tvf examples/02_queries.sql and inspect the output of order_summary.
  2. Add a products table and a MERGE statement that upserts prices.
  3. Use db2expln or EXPLAIN PLAN FOR to inspect the access plan for the revenue query.
  4. Create a tablespace and move an index into it (requires more Db2 administration than the default lab setup).

Notes and limits

  • The image is large (several GB) and needs roughly 4 GB of RAM. First start can take 5-10 minutes.
  • Db2 Community Edition is free for development, but review IBM's license terms before production use.
  • The container runs as privileged because Db2 needs kernel settings that the image manages itself.
  • This image is published for linux/amd64. Apple Silicon users need emulation.

Run it from anywhere

This lab publishes its ports on 127.0.0.1 only. To use it from another country, do not open the database port to the internet. Pick one:

  • VPS + private tunnel: run the lab on a small Ubuntu VPS, keep the port closed, and connect through WireGuard or ssh -L.
  • Managed service: use a managed free tier for this engine and point the same examples at its connection string.
  • HTTP UI only: if the engine has a web UI, put it behind Caddy with TLS and basic auth.

The shared checklist, provider map, and commands are in REMOTE-ACCESS.md.

Cleanup

docker compose down -v

-v also removes the named volume, so the next start is a clean slate.

References


Part of the database-labs collection: 26 database engines, one index.

License

MIT (c) 2026 Arya Fatthurahman. See LICENSE.


Tech Stack

Git
Full Tech Stack Wall

Languages
Rust Go TypeScript JavaScript Java Python C C++ Kotlin Swift Ruby PHP Lua Shell

Frontend & Desktop
Vue React Svelte Next.js Nuxt Flutter React Native Tauri Electron Vite HTML5 CSS3 Sass Less Tailwind CSS Bootstrap Three.js Node.js jQuery

Database & Storage
MySQL PostgreSQL SQLite SQL Server Oracle Redis MongoDB DuckDB ClickHouse Elasticsearch Neo4j InfluxDB Cassandra DynamoDB Firebase Supabase MinIO Firebird IBM DB2 MariaDB CockroachDB IRIS Databricks SQL Snowflake Qdrant Redshift Apache Kylin BigQuery VictoriaMetrics Databend TDengine Teradata

Messaging & Streaming
Kafka RabbitMQ RocketMQ Pulsar Flink

DevOps & Cloud Native
Docker Kubernetes Terraform Ansible Jenkins GitHub Actions GitLab CI Prometheus Grafana Nginx AWS Azure Cloudflare

Tools & Platforms
Git Linux macOS VS Code Vim Tmux Homebrew Postman Figma Markdown Maven Gradle CMake

Hands-on engineering, built and documented in the open.

DBX Connections

Firebird_5n1b JDBCX_d5pn IBM DB2_0leg MariaDB_80g9 SQL Server_wieh CockroachDB_mo9c IRIS_cz3h Databricks_SQL_rmue Snowflake_cm_h9 Redis_u0tv Qdrant_1r3s Elasticsearch_zfc3 Cassandra_d8eb MongoDB_vexq Redshift_p9d7 Apache Kylin_xmpz Neo4j_j3dsg BigQuery_homk Apache Kafka_xpqk VictoriaMetrics_m3sf InfluxDB_wuju Databend_dey6 TDengine_4c9i Teradata_rwlm

Connection names shown in the DBX sidebar - decorative reference badges.

About

Start IBM Db2 Community Edition in Docker, create a schema, and practice Db2 SQL and the command line processor.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors