Public Repository

Last pushed: a year ago
Short Description
IBM DB2 Express-C
Full Description

What is IBM DB2 Express-C ?

``IBM DB2 Express-C``` is the no-charge community edition of DB2 server, a simple, flexible, powerful, and reliable relational database server. It is easy to install, embed, deploy, and available for download, deployment, and redistribution at no charge

  • Uses Time Travel Query to provide bi-temporal data management.
  • Delivers an integrated tools environment with IBM Data Studio for easier management and development.
  • Includes Graph Store technology to efficiently store graph triples for reduced costs and enhanced performance.
  • Contains the SQL Compatibility feature making it easier to run applications written for other major databases, on DB2.

IBM DB2 Express-C is available for download and deployment at no charge. Optional yearly subscription is available for users who require technical support or additional functionality, such as High Availability, Row and Column Access Control and SQL Replication.

DB2 for Linux, UNIX and Windows

DB2 Express-C

Resource Center

Supported tags

  • latest (`

The supported tags stands for <db2 version> - <Linux kernel version of Docker Engine>.
DB2 Docker images can be deployed on a Docker Engine with any flavour of Linux , as long as it has the compatible Linux ``kernel-3.10.0, likeCentOS 7``` respectively.

  • Please make sure your Docker Engine has a compatible Linux kernel
  • Please use Docker 1.6.0 or later release on Ubuntu Docker Engine or Boot2Docker since there is a known issue with [aufs and direct io] (

Set up Docker environment on your laptop

How to use this image ?

This docker image has to be deployed to Docker Engine on one of supported Cloud providers or your own system. The instructions for creating Docker Engine vary by Cloud provider. We recommend to use [Docker Machine (beta)] ( to provision Docker Engine.

In order to use the image, it is necessary to accept the terms of the DB2 Express-C license. This is achieved by specifying the environment variable LICENSE equal to accept when running the image.

This docker image contained pre-deployed DB2 Express-C with the default DB2 instance, db2inst1.

1 - Start a container

docker run -it -p 50000:50000 -e DB2INST1_PASSWORD=db2inst1-pwd -e LICENSE=accept ibmcom/db2express-c:latest bash
  • -p 50000:50000 exposes port 50000 to allow connections from the remote client.
  • By specifying -e DB2INST1_PASSWORD=db2inst1-pwd parameter, you set a password of your choice for the db2inst1 user for the default DB2 instance.
  • By specifying -e LICENSE=accept parameter, you are accepting this License to use the software contained in this image.

2 - Start DB2 and create sample DB
Please switch to the default db2 instance user db2inst1 to start DB2 instance and create a sample database if you want :

$ su - db2inst1
$ db2start
$ db2sampl
  • The time of creating a sample database depends on your system performance, which may take several minutes.
  • You can create another database using db2 create db <dbname> command.

3 - Note

1) Start as a daemon
You can start a container as a daemon with DB2 services up/running :

docker run -d -p 50000:50000 -e DB2INST1_PASSWORD=db2inst1-pwd -e LICENSE=accept  ibmcom/db2express-c:latest db2start
  • db2start, db2 services start automatically and remote client can connect to it at port 50000

2) Mount a volume
While starting a Docker container, you can mount a volume from a directory on the Docker host like the following command :

docker run -it -p 50000:50000 -e DB2INST1_PASSWORD=db2inst1-pwd -e LICENSE=accept   -v  $(pwd):/share  ibmcom/db2express-c:latest bash
  • /share, referring to mount point at "/share" in the Docker.
  • $(pwd), the current directory on Docker host while running Docker command, which is mounted by Docker container. It can also be any existing directory on Docker host, like /tmp, /opt, etc.
  • If you want to use the mounted volume for DB2 system or data storage, please update DB2 manager configuration according to IBM Knowledge Center

3) DB2 is deployed in the Docker Engine in:



The Dockerfile and associated scripts are licensed under the Apache License 2.0. DB2 Express-C is licensed under the IBM International License Agreement for Non-Warranted Programs. This license for DB2 Express-C can be found online. Note that this license does not permit further distribution.

Supported Docker versions

  • This image is officially supported on Docker version 1.6.0.
  • Support for older versions (down to 1.0) is provided on a best-effort basis.

Community Support

  • Zhong Yu (Leo) Wu (
  • Emerging Technology Team (, IBM Analytics Platform

Like this image? Give us a star at the top of this page!

Docker Pull Command

Comments (51)
14 days ago

Persisting data between container changes:

Add -v /path_to_data/:/home/db2inst1/db2inst1 to the run command.

When you create a new container, log in to restore the data:

#> docker exec -ti -u 1000 my-db2-container /bin/bash

#> db2 list active databases
SQL1611W No data was returned by Database System Monitor.

#> db2 catalog database MYDATABASE
DB20000I The CATALOG DATABASE command completed successfully.
DB21056W Directory changes may not be effective until the directory cache is

#> db2 list active databases

                       Active Databases

Database name = MYDATABASE
Applications connected currently = 2
Database path = /home/db2inst1/db2inst1/NODE0000/SQL00001/MEMBER0000/

The command to refresh the cache is db2 TERMINATE

19 days ago

i am able to connect to the DB2 over 5000 port,however i need to transport the sql commands to container and then run it.. Tried exposing and connecting to 22 port but connection refused

3 months ago

Is it possible to connect with jtopen jdbc driver?
Thank you.

4 months ago

It does not look like these comments are monitored by the original project creators. Will try sending an email to the ID listed under community support.

4 months ago

Where should I mount a volume to persist my data? /db2inst1 ?

4 months ago

when I try to create a new database it throws error
SQL1032N No start database manager command was issued. SQLSTATE=57019
Can anyone help me how to resolve this ?

4 months ago

Noticed somewhere in the comment history, that both instance path and database path needs to be updated for using mounted volume. Any instructions on how to update instance path?


4 months ago

Hi, hope someone can help, i'm able to mounted volume using following command:

db2 "update dbm cfg using dftdbpath /share/db2Data immediate"

The commands goes well but then i get the following error when trying to create new database:

SQL1042C An unexpected system error occurred. SQLSTATE=58004

4 months ago

You can create a database at startup if you overwrite the / script.

The default does something like:
if [[ $1 = "db2start" ]]; then
su - db2inst1 -c "db2start"
nohup /usr/sbin/sshd -D 2>&1 > /dev/null &
while true; do sleep 1000; done
exec "$1"

You can add a command after db2start runs:
su - db2inst1 -c "db2 create database testdatabase"

4 months ago

Able to run locally but looking for some detailed steps on how to use persistent storage. I would like to start/stop container and not lose the DB and its data.
Are there any setup guide out there that I could use?