Skip to content

Dockerfile for the DB2 Command Line Processor (CLP).

License

Notifications You must be signed in to change notification settings

SamMacy/docker-db2

Repository files navigation

docker-db2

Overview

This Dockerfile is a wrapper over the DB2 command-line interface, a.k.a. Command line processor.

Contents

  1. Create Docker container
  2. Run Docker container
  3. Start DB2 Command-line processor

Create docker container

docker build --tag senzing/db2 https://github.com/senzing/docker-db2.git

Run Docker container

  1. Option #1 - Run the docker container without volumes or network.

    Identify the db2inst1 user's password. Example:

    export DB2INST1_PASSWORD=password

    Run docker container.

    docker run -it  \
      --env DB2INST1_PASSWORD=${DB2INST1_PASSWORD} \
      --env LICENSE="accept" \
      senzing/db2
  2. Option #2 - Run the docker container with volumes.

    Identify the Senzing directory. Default: /opt/senzing. Example:

    export SENZING_DIR=/opt/senzing

    Run docker container.

    docker run -it  \
      --volume ${SENZING_DIR}:/opt/senzing \
      --env DB2INST1_PASSWORD=${DB2INST1_PASSWORD} \
      --env LICENSE="accept" \
      senzing/db2
  3. Option #3 - Run the docker container in a docker network.

    Identify the Docker network of the DB2 database. Example:

    docker network ls
    
    # Choose value from NAME column of docker network ls
    export DB2_NETWORK=nameofthe_network

    Run docker container.

    docker run -it  \
      --volume ${SENZING_DIR}:/opt/senzing \
      --net ${DB2_NETWORK} \
      --env DB2INST1_PASSWORD=${DB2INST1_PASSWORD} \
      --env LICENSE="accept" \
      senzing/db2

Start DB2 Command-line processor

  1. At the docker container's /bin/bash prompt:

    su - db2inst1
    db2

Example DB2 commands

  1. Become db2inst1 user. At the docker container's /bin/bash prompt:

    su - db2inst1
  2. Example db2 commands:

    db2 catalog tcpip node G2 remote senzing-db2 server 50000
    db2 terminate
    db2 list node directory
    db2 attach to G2 user db2inst1 using db2inst1
    db2 create database g2 using codeset utf-8 territory us
    db2 connect to g2 user db2inst1 using db2inst1
    db2 -tf /opt/senzing/g2/data/g2core-schema-db2-create.sql | tee /tmp/g2schema.out
    db2 connect reset

About

Dockerfile for the DB2 Command Line Processor (CLP).

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published