IBM DB2 with Docker


Actually it's like a magic. Follow these steps:

1. Create folder D:\docker\db2-11.5.8.0

2. Create folder D:\docker-install-db\ibm-db2

3. Create file "Dockerfile" (without any extension name) inside D:\docker-install-db\ibm-db2

4. These syntax of Dockerfile :

FROM ibmcom/db2:latest

ENV TZ="Asia/Jakarta"

RUN date

EXPOSE 50000

5. Build image for ibm-db2 with Dockerfile

$ docker build --no-cache --progress=plain -t database/db2:latest .

6. Build container and run it

$ docker run -it --name ctr-db2 --privileged=true -p 50000:50000 -p 55000:55000 -e "su - ${DB2INSTANCE}" -e LICENSE=accept -e DB2INSTANCE=db2inst1 -e DB2INST1_PASSWORD=db2inst1 -e DBNAME=dbpublic -e ENABLE_ORACLE_COMPATIBILITY=true -v D:\docker\db2-11.5.8.0:/database -d database/db2:latest


Test database connection

Host: 127.0.0.1

Port: 50000

Database: dbpublic

Db-Username: db2inst1

Db-Password: db2inst1


Success!

Comments