This project allows to Dockerize IBM DB2 database. The image will contain DB2 installation and a single instance ready to accept connections. Database(s) should be added manually.
Clone git project
git clone https://github.com/stanislawbartkowski/docker-db2.git
cd docker-db2
cd docker-db2
Prepare DB2 installation image
Download and unpack IBM DB2 installation image into docker-db2 folder. Only unpacked files should be moved there, without source .gz or .zip file.
For instance, after unpacking AESE Edition of DB2, the directory structure should look.
For instance, after unpacking AESE Edition of DB2, the directory structure should look.
The installFixPack command is used to install the fix pack. To apply an offline fix pack update to existing DB2 database products in a DB2 pureScale instance, refer to Installing offline fix pack updates to a DB2 pureScale instance (simplified method). Jul 12, 2018 Db2 Express-c has been replaced by the Db2 Community Edition which is the default edition for Db2, Like express-c it cane used for production or non production with community support like Express-C. It is available via docker or by downloading the Db2.
- docker-db2
- main.sh
- Dockerfile
- server_aese_c
- db2
- db2checkCOL_readme.txt
- db2checkCOL.tar.gz
- db2ckupgrade
- db2_deinstall
- db2_install
- db2ls
- db2prereqcheck
- db2setup
- ibm_im
- installFixPack nlpack
For DB2 Express-C edition
- docker-db2
- main.sh
- Dockerfile
- expc
- db2
- db2ckupgrade
- db2_deinstall
- db2_install
- db2ls
- db2prereqcheck
- db2setup
Customization
INSTDIR argument is necessary for building process. It is the root directory for DB2 installation files. In the above example, the INSTDIR should be server_aese_c.
Also argument PARS is mandatory. It is an additional parameter for IBM DB2 installer specific to the particular DB2 version. Incorrect value will cause installation failure difficult to pin down.
The Docker image can be customized by several build variables.
Also argument PARS is mandatory. It is an additional parameter for IBM DB2 installer specific to the particular DB2 version. Incorrect value will cause installation failure difficult to pin down.
The Docker image can be customized by several build variables.
Variable name | Default | Description |
---|---|---|
INSTDIR | Mandatory, no default | The root path of unpacked DB2 installation files |
INSTPATH | /opt/ibm/db2/V11.1 | Installation path for DB2, the path inside container file syste, |
DB2USER | db2inst1 | DB2 instance owner |
DB2PORT | 50000 | DB2 TCP/IP connection port |
DB2PASSWORD | db2inst1 | DB2 instance owner password |
PARS | Mandatory, no default | Additional parameter passed to DB2 installer. For AESE the value should be -b SERVER, for DB2 Express-C -y |
FIXDIR | not defined | root directory for DB2 FixPack, look below. If not defined, only main installation is conducted. |
Important: Even if the default password is changed, it can be easily extracted by running docker history whatsoever. In order to keep the password confidential, change it later in the container manually.
![Db2 Express C Db2 Installfixpack Db2 Express C Db2 Installfixpack](/uploads/1/2/6/2/126272961/714878857.png)
Build the image
You can change the image name (here db2) to any other name.
DB2 Express-C
docker build --build-arg INSTDIR=expc --build-arg PARS=-y -t db2 .
DB2 AESE
docker build --build-arg INSTDIR=server_aese_c --build-arg PARS=-p SERVER -t db2 .
DB2 11.5, 'IBM DB2 Developer-C Edition'
docker build --build-arg INSTDIR=server_dec --build-arg INSTPATH=/opt/ibm/db2/V11.5 --build-arg PARS='-p SERVER -y' -t db2 .
The building process takes several minutes. An intermediate image is created to get rid of DB2 installation files which are redundant after installation and to avoid pumping up the image size. So the yum update and yum install commands are execute twice, once inside the intermediate image and the second time inside the final image.
During DB2 installation the following error message can be reported, just ignore it.
After the image is completed, remove the intermediate image.
docker image prune
Apply IBM DB2 FixPack
Together with DB2 installation, the FixPack can applied at the same time. This option is available only for licensed version of DB2, DB2 Express-C cannot be upgraded that way.
Firstly unpack compressed file containing FixPack payload into DB2 installation directory. After unpacking the FixPack, the installation directory should look:
- docker-db2
- main.sh
- Dockerfile
- server_aese_c
- db2
- db2checkCOL_readme.txt
- db2checkCOL.tar.gz
- db2ckupgrade
- db2_deinstall
- db2_install
- db2ls
- db2prereqcheck
- db2setup
- ibm_im
- installFixPack nlpack
- server_t
- db2
- db2checkCOL_readme.txt
- db2checkCOL.tar.gz
- db2ckupgrade db2_deinstall
- db2_install db2ls
- db2prereqcheck
- db2setup
- ibm_im
- installFixPack
Then run docker build image command and define additional FIXDIR argument equal to root directory of FixPack files inside main install directory (here server_t)
docker build --build-arg INSTDIR=server_aese_c --build-arg PARS='-p SERVER' --build-arg FIXDIR=server_t -t db2 .
After main installation, the build process executes ${FIXDIR}/installFixPack command with appropriate parameters.
Db2 on PowerPC platform requires additional dependency. It is resolved by command:
ADD ibm-xl-compiler-eval.repo /etc/yum.repos.d/ibm-xl-compiler-eval.repo
RUN if [ '$HOSTTYPE' 'powerpc64le' ]; then yum -y install 'libxlc*'; fi
RUN if [ '$HOSTTYPE' 'powerpc64le' ]; then yum -y install 'libxlc*'; fi
Initialize
The container should run as --privileged. The name of the container (here db2) could be any other.
docker run --privileged -d -p 50000:50000 --name db2 db2
The very first thing to do is to create a database, the image contains an empty DB2 instance. The container DB2 instance can be accessed remotely, using DB2 client software.
Remote access to DB2 instance
db2 catalog tcpip node DB2CONT remote localhost server 50000
Create a database
db2 attach to DB2CONT user db2inst1
db2 create database DB2DB
Database creation will take several minutes, it is as expected.
db2 list db directory
Connect to database
db2 connect to DB2DB user db2inst1
Stop the container
docker stop db2
Start the container
docker start db
Get access to the container. The instance owner password can be changed this way.
docker exec -it db2 /bin/bash
- Download
Thank you for using our software library. To download the product you want for free, you should use the link provided below and proceed to the developer's website, as this is the only legal source to get DB2 Express-C.
However, we must warn you that downloading DB2 Express-C from an external source releases FDM Lib from any responsibility. Please carefully check your downloads with antivirus software. FDM Lib shall include an option for direct download from developers, should it become available in the future.
Often downloaded with
- DB2 Administration ClientA DB2 Administration Client provides the ability for workstations from a...DOWNLOAD
- 1C:Enterprise1C:Enterprise is directly competitive with SAP and Microsoft Dynamics. In...$299DOWNLOAD
- Stylus StudioStylus Studio 2006 XML Enterprise Edition is an advanced XML Integrated...DOWNLOAD
- Altova XMLSpy Professional EditionAltova XMLSpy 2015 Professional Edition is the industry-leading XML editor and...$499DOWNLOAD
- Altova XMLSpy Enterprise EditionAltova XMLSpy (Enterprise Edition) is the industry's best-selling XML editor...$999DOWNLOAD