Skip to content

Instantly share code, notes, and snippets.

@nastacio
Created November 22, 2019 11:53
Show Gist options
  • Save nastacio/58fda519094746d75614fb630e9b6a0f to your computer and use it in GitHub Desktop.
Save nastacio/58fda519094746d75614fb630e9b6a0f to your computer and use it in GitHub Desktop.
DB2 local instance with sample database
### (Optional) Create local DB2 instance
#### Create local network
```
docker network create workshop_nw
```
#### Create DB2 database (local docker container)
```
cat > .db2_docker_install_env_list << EOF
LICENSE=accept
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=password
DBNAME=testdb
BLU=false
ENABLE_ORACLE_COMPATIBILITY=false
UPDATEAVAIL=NO
TO_CREATE_SAMPLEDB=true
REPODB=false
IS_OSXFS=true
PERSISTENT_HOME=true
HADR_ENABLED=false
ETCD_ENDPOINT=
ETCD_USERNAME=
ETCD_PASSWORD=
EOF
```
*Pay attention to whether you put true or false in IS_OSXFS depending on your local OS*
```
docker pull store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
mkdir -p ~/tmp/db2_storage_dir
docker run -h db2server --name db2server --network workshop_nw --restart=always --detach --privileged=true -p 50000:50000 -p 55000:55000 --env-file .db2_docker_install_env_list -v ~/tmp/db2_storage_dir:/database store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
```
Populate the database with the [DB2 Sample Database](https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.samptop.doc/doc/r0001094.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment