├── .travis.yml ├── LICENSE ├── README.md ├── db2-db2inst1 ├── 10.5 │ └── server_t │ │ └── Dockerfile ├── 11.1 │ └── server_t │ │ └── Dockerfile └── expc │ ├── Dockerfile │ ├── README-short.txt │ ├── README.md │ └── logo.png ├── db2-install ├── 10.5 │ └── server_t │ │ ├── Dockerfile │ │ ├── createInstance │ │ ├── db2server_t_install.rsp │ │ ├── db2server_t_instance.rsp │ │ └── download ├── 11.1 │ └── server_t │ │ ├── Dockerfile │ │ ├── createInstance │ │ ├── db2server_t_install.rsp │ │ ├── db2server_t_instance.rsp │ │ └── download └── expc │ ├── .dockerignore │ ├── Dockerfile │ ├── README-short.txt │ ├── README.md │ ├── createInstance │ ├── db2expc_install.rsp │ ├── db2expc_instance.rsp │ ├── download │ └── logo.png ├── expc └── images ├── Download1.PNG ├── Download2.PNG └── Download3.PNG /.travis.yml: -------------------------------------------------------------------------------- 1 | env: 2 | - ENV=expc 3 | - ENV=ese-10.5 4 | - ENV=ese-11.1 5 | 6 | sudo: required 7 | 8 | services: 9 | - docker 10 | 11 | before_install: 12 | # Builds Express-C image 13 | - if [ ${ENV} = 'expc' ] ; then 14 | docker build -t angoca/db2-install:expc db2-install/expc/ ; docker images ; 15 | fi 16 | - if [ ${ENV} = 'expc' ] ; then 17 | docker build -t angoca/db2-db2inst1:expc db2-db2inst1/expc/ ; docker images ; 18 | fi 19 | # Builds Enterprise Server Edition image for V10.5 20 | - if [ ${ENV} = 'ese-10.5' ] ; then 21 | docker build -t angoca/db2-install:ese-10.5 db2-install/10.5/server_t/ ; docker images ; 22 | fi 23 | - if [ ${ENV} = 'ese-10.5' ] ; then 24 | docker build -t angoca/db2-db2inst1:ese-10.5 db2-db2inst1/10.5/server_t/ ; docker images ; 25 | fi 26 | # Builds Enterprise Server Edition image for V11.1 27 | - if [ ${ENV} = 'ese-11.1' ] ; then 28 | docker build -t angoca/db2-install:ese-11.1 db2-install/11.1/server_t/ ; docker images ; 29 | fi 30 | - if [ ${ENV} = 'ese-11.1' ] ; then 31 | docker build -t angoca/db2-db2inst1:ese-11.1 db2-db2inst1/11.1/server_t/ ; docker images ; 32 | fi 33 | 34 | script: 35 | - docker images 36 | # Name of the instance 37 | - DB2USER=db2inst1 38 | 39 | # Starts Express-C image 40 | - if [ ${ENV} = 'expc' ] ; then 41 | echo ". /home/${DB2USER}/sqllib/db2profile ; db2start ; db2sampl ; db2 connect to sample ; cat /home/${DB2USER}/sqllib/db2dump/db2diag.log " | docker run -i --ipc="host" --privileged=true --name="${DB2USER}" -p 50000:50000 angoca/db2-db2inst1:expc ; 42 | fi 43 | # Starts Enterprise Server Edition image 44 | - if [ ${ENV} = 'ese-10.5' ] || [ ${ENV} = 'ese-11.1' ] ; then 45 | echo ". /home/${DB2USER}/sqllib/db2profile ; db2start ; db2 create db test ; db2 connect to test ; cat /home/${DB2USER}/sqllib/db2dump/db2diag.log " | docker run -i --ipc="host" --privileged=true --name="${DB2USER}" -p 50000:50000 angoca/db2-db2inst1:${ENV} ; 46 | fi 47 | 48 | # Starts the instance and creates a database. 49 | #- docker ps -a 50 | #- docker start $(docker ps -a -q) 51 | #- docker exec -u ${DB2USER} $(docker ps -a -q) ". ~${DB2USER}/sqllib/db2profile ; db2start" 52 | #- docker exec -u ${DB2USER} $(docker ps -a -q) ". ~${DB2USER}/sqllib/db2profile ; db2 create db test" 53 | #- docker exec -u ${DB2USER} $(docker ps -a -q) ". ~${DB2USER}/sqllib/db2profile ; db2 connect to test" 54 | 55 | after_success: 56 | # Logs into Docker 57 | - if [ "$TRAVIS_BRANCH" == "master" ] ; then 58 | docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" ; 59 | fi 60 | 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015,2018 Andres Gomez Casanova 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The README file can be found in db2-install/expc/README.md 2 | -------------------------------------------------------------------------------- /db2-db2inst1/10.5/server_t/Dockerfile: -------------------------------------------------------------------------------- 1 | # This Docker creates a db2instance 2 | # 3 | # Version: 2016-05-16 4 | # Author: Andres Gomez Casanova (AngocA) 5 | # Made in COLOMBIA. 6 | 7 | FROM angoca/db2-install:ese-10.5 8 | 9 | MAINTAINER Andres Gomez 10 | 11 | # Set of variables to define the type of DB2 being installed. 12 | 13 | ## Script to create the instance 14 | ENV DB2_INST_CREA_SCR=createInstance \ 15 | ## Directory for all scripts. 16 | DB2_CONF=/tmp/db2_conf \ 17 | ## Response file name 18 | DB2_RESP_FILE=db2server_t_instance.rsp \ 19 | ## Default instance name 20 | INSTANCE_NAME=db2inst1 21 | 22 | WORKDIR /tmp/db2_conf 23 | 24 | RUN /tmp/db2_conf/${DB2_INST_CREA_SCR} && \ 25 | # Modifies the db2nodes file to include a valid name. 26 | cat /home/${INSTANCE_NAME}/sqllib/db2nodes.cfg && \ 27 | echo "0 localhost 0" > /home/${INSTANCE_NAME}/sqllib/db2nodes.cfg && \ 28 | cat /home/${INSTANCE_NAME}/sqllib/db2nodes.cfg 29 | 30 | EXPOSE 50000 31 | 32 | USER db2inst1 33 | 34 | WORKDIR /home/db2inst1 35 | 36 | -------------------------------------------------------------------------------- /db2-db2inst1/11.1/server_t/Dockerfile: -------------------------------------------------------------------------------- 1 | # This Docker creates a db2instance 2 | # 3 | # Version: 2018-01-28 4 | # Author: Andres Gomez Casanova (AngocA) 5 | # Made in COLOMBIA. 6 | 7 | FROM angoca/db2-install:ese-11.1 8 | 9 | LABEL maintainer="angoca@yahoo.com" 10 | 11 | # Set of variables to define the type of DB2 being installed. 12 | 13 | ## Script to create the instance 14 | ENV DB2_INST_CREA_SCR=createInstance \ 15 | ## Directory for all scripts. 16 | DB2_CONF=/tmp/db2_conf \ 17 | ## Response file name 18 | DB2_RESP_FILE=db2server_t_instance.rsp \ 19 | ## Port number for Db2 20 | PORT=50000 \ 21 | ## Default instance name 22 | DEFAULT_INSTANCE_NAME=db2inst1 23 | 24 | WORKDIR ${DB2_CONF} 25 | 26 | ARG INSTANCE_NAME=${DEFAULT_INSTANCE_NAME} 27 | 28 | RUN ${DB2_CONF}/${DB2_INST_CREA_SCR} ${INSTANCE_NAME} && \ 29 | # Modifies the db2nodes file to include a valid name. 30 | cat /home/${INSTANCE_NAME}/sqllib/db2nodes.cfg && \ 31 | echo "0 localhost 0" > /home/${INSTANCE_NAME}/sqllib/db2nodes.cfg && \ 32 | cat /home/${INSTANCE_NAME}/sqllib/db2nodes.cfg 33 | 34 | USER ${INSTANCE_NAME} 35 | 36 | WORKDIR /home/${INSTANCE_NAME} 37 | 38 | EXPOSE ${PORT} 39 | 40 | -------------------------------------------------------------------------------- /db2-db2inst1/expc/Dockerfile: -------------------------------------------------------------------------------- 1 | # This Docker creates a db2instance 2 | # 3 | # Version: 2018-01-28 4 | # Author: Andres Gomez Casanova (AngocA) 5 | # Made in COLOMBIA. 6 | 7 | FROM angoca/db2-install:expc 8 | 9 | # MicroBadge 10 | ARG VCS_REF 11 | 12 | LABEL maintainer="angoca@yahoo.com" \ 13 | org.label-schema.build-date=${BUILD_DATE} \ 14 | org.label-schema.name="db2-docker" \ 15 | org.label-schema.description="Docker container for IBM DB2 for LUW" \ 16 | org.label-schema.url="https://github.com/angoca/db2-docker/wiki" \ 17 | org.label-schema.vcs-ref=$VCS_REF \ 18 | org.label-schema.vcs-url="https://github.com/angoca/db2-docker" \ 19 | org.label-schema.vendor="AngocA" \ 20 | org.label-schema.version="1.0-11.1-instance-expc" \ 21 | org.label-schema.schema-version="1.0" 22 | 23 | # Set of variables to define the type of DB2 being installed. 24 | 25 | ## Script to create the instance 26 | ENV DB2_INST_CREA_SCR=createInstance \ 27 | ## Directory for all scripts. 28 | DB2_CONF=/tmp/db2_conf \ 29 | ## Port number for Db2 30 | PORT=50000 \ 31 | ## Default instance name 32 | DEFAULT_INSTANCE_NAME=db2inst1 33 | 34 | WORKDIR ${DB2_CONF} 35 | 36 | ARG INSTANCE_NAME=${DEFAULT_INSTANCE_NAME} 37 | 38 | RUN ${DB2_CONF}/${DB2_INST_CREA_SCR} ${INSTANCE_NAME} 39 | 40 | USER ${INSTANCE_NAME} 41 | 42 | WORKDIR /home/${INSTANCE_NAME} 43 | 44 | EXPOSE ${PORT} 45 | 46 | -------------------------------------------------------------------------------- /db2-db2inst1/expc/README-short.txt: -------------------------------------------------------------------------------- 1 | 3. DB2 instance (db2inst1) running without any database on port 50000 2 | -------------------------------------------------------------------------------- /db2-db2inst1/expc/README.md: -------------------------------------------------------------------------------- 1 | ## Supported tags and respective `Dockerfile` links 2 | 3 | * [`expc`, `latest` (db2-db2inst1/expc/Dockerfile)](https://github.com/angoca/db2-docker/blob/master/db2-db2inst1/expc/Dockerfile) 4 | * [`11.1-ese`, `ese` (db2-db2inst1/11.1/server_t/Dockerfile)](https://github.com/angoca/db2-docker/blob/master/db2-db2inst1/11.1/server_t/Dockerfile) 5 | * [`10.5-ese` (db2-db2inst1/10.5/server_t/Dockerfile)](https://github.com/angoca/db2-docker/blob/master/db2-db2isnt1/10.5/server_t/Dockerfile) 6 | 7 | ## What is DB2? 8 | 9 | IBM DB2 is a family of database server products developed by IBM. These products all support the relational model, but in recent years some products have been extended to support object-relational features and non-relational structures, in particular XML. 10 | 11 | Historically and unlike other database vendors, IBM produced a platform-specific DB2 product for each of its major operating systems. However, in the 1990s IBM changed track and produced a DB2 "common server" product, designed with a common code base to run on different platforms. 12 | 13 | * [wikipedia.org/wiki/IBM_DB2](https://en.wikipedia.org/wiki/IBM_DB2) 14 | * [DB2 LUW](http://www.ibm.com/analytics/us/en/technology/db2/) 15 | * [DB2 Express-C](http://www.ibm.com/software/data/db2/express-c/download.html) 16 | 17 | ![DB2 logo](https://raw.githubusercontent.com/angoca/db2-docker/master/db2-db2inst1/expc/logo.png) 18 | 19 | # What is a DB2 instance? 20 | 21 | A DB2 instance is a running process that controls the security at the higher level, listens on a specific port, controls the databases it hosts, and many other operations related to database administration. 22 | 23 | ## Set of images 24 | 25 | This image is part of a set of images to create your DB2 environment: 26 | 27 | * [db2-install: Downloads and installs DB2](https://registry.hub.docker.com/u/angoca/db2-install/) 28 | * [![](https://images.microbadger.com/badges/image/angoca/db2-install.svg)](https://microbadger.com/images/angoca/db2-install "Get your own version badge on microbadger.com") 29 | * [db2-db2inst1: Instance db2inst1 created](https://registry.hub.docker.com/u/angoca/db2-db2inst1/) 30 | * [![](https://images.microbadger.com/badges/image/angoca/db2-db2inst1.svg)](https://microbadger.com/images/angoca/db2-db2inst1 "Get your own image badge on microbadger.com") 31 | * [db2-sample: Database sample created (Without Dockerfile)](https://registry.hub.docker.com/u/angoca/db2-sample/) 32 | * [![](https://images.microbadger.com/badges/image/angoca/db2-sample.svg)](https://microbadger.com/images/angoca/db2-sample "Get your own version badge on microbadger.com") 33 | 34 | This is the stack of images: 35 | 36 | +-----------------+ 37 | | 3) db2-sample | <-- Sample database (db2sampl) 38 | +-----------------+ 39 | | 2) db2-db2inst1 | <-- Default instance created (db2inst1:50000) 40 | +-----------------+ 41 | | 1) db2-install | <-- DB2 Express-C installed 42 | +-----------------+ 43 | 44 | ## How to use this image 45 | 46 | This image creates a DB2 instance based on the scripts that prepares the environment in the previous image. It uses the [`angoca/db2-install`](https://registry.hub.docker.com/u/angoca/db2-install/) image that install Db2 and prepares the environment to create instances. 47 | 48 | The container provides a created instance with the `db2inst1` user and listening on port `50000` with home directory `/home/db2inst1`. These instructions are provided from the response file of the previous image and the whole process is performed from ./createInstance script. However, the name can be changed via arguments. 49 | 50 | Once the instance is created, the container can be executed but it needs to be run in privileged mode because a DB2 instance requieres extra permissions to be run. 51 | 52 | sudo docker run -i -t --privileged=true --name="db2inst1" -p 50000:50000 angoca/db2inst1 53 | 54 | The name of the container will be `db2inst1`. 55 | 56 | Depending on your configuration, you can try the following line in order to not use privileged mode but only the necessary elements for DB2: 57 | 58 | sudo docker run -i -t --ipc="host" --cap-add IPC_LOCK --cap-add IPC_OWNER --name="db2inst1" -p 50000:50000 angoca/db2-instance 59 | 60 | Please, check the [Travis-CI execution](https://travis-ci.org/angoca/db2-docker) to see how this image is build. 61 | 62 | Once you have finished the configuration, you can leave the container running by typing: 63 | 64 | Ctrl + P + Q 65 | 66 | ## Next steps 67 | 68 | Now, you can create a database and start using DB2: 69 | 70 | su - db2inst1 71 | db2 create db mydb 72 | 73 | If the db2 command is not accepted, it is because the db2profile is not loaded. You can reload the profile with the following command: 74 | 75 | . ~db2inst1/sqllib/db2profile 76 | 77 | Take a look that there is a space between the dot and the file name, this is because we are using the source command. Also, the db2inst1 is the supposed instance name. 78 | 79 | Also, you can create the Sample database and play with a database already populated with data. 80 | 81 | su - db2inst1 82 | db2sampl 83 | 84 | **Note**: For more information please take a look at the documentation of the db2-instance image in Docker Hub. It has more details about shared storage and ackowledgements to all the people that have helped to create these images. 85 | 86 | # Advantages of these images 87 | 88 | The advantages to use this image instead of the other are: 89 | 90 | * The DB2 binary file is downloaded semi-automatically. The wiki has a valid link and this is the only thing that needs to be modified. The other images requiere to modify the image with a valid link or to have DB2 installer/binaries locally in the machine. 91 | * This image has a mechanism to create more instances with a simple script that uses a response file. The instance owner can have any name; it is not limited to `db2inst1` or something like `db2instX` where X is a number. 92 | * The environment can be configured in different ways. It is not limited to a fixed instance or database. The set of images provide different levels of flexible configuration. 93 | * The images are published in Docker in the `angoca` repository. The image is not created on the fly. The basic images are created from Dockerfiles, the last one was published in the repository with the database already created. As part of the publish, a corresponding documentation is provided. 94 | * The images can be found by performing a search in Docker. This allows to have a better visibility. 95 | * It was developed by a DB2 DBA. This makes this image appropriate not only for developers but also for DBAs and SysAdmins. 96 | * The complete installation and configuration is divided in different images. This makes the solution more flexible and easy to extent. 97 | * The image are based on recent versions. For example one of the last fixpacks in Db2 v10.5, and the most recent fixpack in v11.1. Also, a recent version of Linux Ubuntu is used; for v11.1 is used Ubuntu 16.04. 98 | * This image is based on a Linux distribution supported by IBM, which is Ubunut. CentOs is not supported. 99 | * There is documentation. This is very important for new users to understand the structure of the images. 100 | 101 | ## User Feedback 102 | 103 | # Issues 104 | 105 | If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/angoca/db2-dockers/issues). 106 | 107 | You can also reach the mainteiner via Twitter [@angoca](https://twitter.com/angoca). 108 | 109 | # Contributing 110 | 111 | You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. 112 | 113 | Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing. 114 | 115 | -------------------------------------------------------------------------------- /db2-db2inst1/expc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angoca/db2-docker/d83274d7c930cf50ae869acebaa35143f1ea2e58/db2-db2inst1/expc/logo.png -------------------------------------------------------------------------------- /db2-install/10.5/server_t/Dockerfile: -------------------------------------------------------------------------------- 1 | # This Docker file downloads the DB2 LUW binaries and installs them in the 2 | # image. It installs the necessary libraries. 3 | # 4 | # This Docker is designed to download a fixpack from IBM and to install DB2 5 | # from it. The fixpack is from the server binaries that correspond to the 6 | # Enterprise Server Edition for 90 days if a license is not applied. 7 | # 8 | # Version: 2018-01-28 9 | # Author: Andres Gomez Casanova (AngocA) 10 | # Made in COLOMBIA. 11 | 12 | FROM ubuntu:14.04 13 | 14 | MAINTAINER Andres Gomez 15 | 16 | # Set of variables to define the type of DB2 being installed. 17 | 18 | ## Version of the downloaded file. 19 | ENV DB2_VERSION=10.5 \ 20 | ## Fixpack of the downloaded file. 21 | DB2_FIXPACK=8 \ 22 | ## Directory of the installers. Associated to the edition. 23 | DB2_INST_DIR=server_t \ 24 | ## Name of the response file included in the Docker image. 25 | DB2_RESP_FILE_INSTALL=db2server_t_install.rsp \ 26 | ## Name of the script that downloads DB2. 27 | DB2_DOWNLOAD=download \ 28 | ## Name of the response file included in the Docker image. 29 | DB2_RESP_FILE_INSTANCE=db2server_t_instance.rsp \ 30 | ## Script to create the instance 31 | DB2_INST_CREA_SCR=createInstance \ 32 | ## Directory for all scripts. 33 | DB2_CONF=/tmp/db2_conf 34 | 35 | ## Name of the downloaded file. 36 | ENV DB2_INSTALLER=v${DB2_VERSION}fp${DB2_FIXPACK}_linuxx64_${DB2_INST_DIR}.tar.gz \ 37 | ## Directory where DB2 is installed. 38 | DB2_DIR=/opt/ibm/db2/V${DB2_VERSION} 39 | 40 | # Copies the script to download 41 | COPY ${DB2_DOWNLOAD} /tmp/${DB2_DOWNLOAD} 42 | 43 | # Copies the response file 44 | COPY ${DB2_RESP_FILE_INSTALL} /tmp/${DB2_RESP_FILE_INSTALL} 45 | 46 | # Run all commands in a single RUN layer to minimize the size of the image. 47 | # Updates Linux. Includes i386 48 | RUN dpkg --add-architecture i386 && \ 49 | apt-get update && \ 50 | apt-get install -y \ 51 | aria2 \ 52 | curl \ 53 | libaio1 \ 54 | libpam-ldap:i386 \ 55 | libstdc++6-4.4-pic \ 56 | lib32stdc++6 && \ 57 | # Download the installer. 58 | ## URL to download the installer. The link is obtained from an article in the Wiki 59 | ## https://github.com/angoca/db2-docker/wiki/db2-link-server_t-10.5 60 | ## That article should contain a valid link as the last line. 61 | ## If the link is not valid, you can modify the wiki. 62 | /tmp/${DB2_DOWNLOAD} && \ 63 | # Extract the installer and delete the tar file. 64 | cd /tmp && \ 65 | tar -zvxf ${DB2_INSTALLER} && \ 66 | rm ${DB2_INSTALLER} && \ 67 | # Install DB2 and remove the installer. 68 | cd /tmp/${DB2_INST_DIR} && \ 69 | ./db2prereqcheck -l && \ 70 | ( ./db2setup -r /tmp/${DB2_RESP_FILE_INSTALL} && \ 71 | cat /tmp/db2setup.log || cat /tmp/db2setup.log ) && \ 72 | ${DB2_DIR}/bin/db2val -o && \ 73 | cd && \ 74 | rm -Rf /tmp/${DB2_INST_DIR} && \ 75 | rm /tmp/${DB2_RESP_FILE_INSTALL} && \ 76 | # Removes the cache of apt-get and the unnecessary packages. 77 | apt-get purge -y aria2 curl && \ 78 | apt-get clean -y && \ 79 | # Removes the list of packages 80 | rm -rf /var/lib/apt/lists/* 81 | 82 | RUN env 83 | # Creates a directory for all scripts 84 | WORKDIR ${DB2_CONF} 85 | 86 | # Copies the response file 87 | COPY ${DB2_RESP_FILE_INSTANCE} ${DB2_CONF}/${DB2_RESP_FILE_INSTANCE} 88 | 89 | # Copies the script to create the instance 90 | COPY ${DB2_INST_CREA_SCR} ${DB2_CONF}/${DB2_INST_CREA_SCR} 91 | 92 | -------------------------------------------------------------------------------- /db2-install/10.5/server_t/createInstance: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Helper to create an instance, start it and change to it. 4 | # This script could receive a parameter for the instance name. 5 | # 6 | # Version: 2018-01-29 7 | # Author: Andres Gomez Casanova (AngocA) 8 | # Made in COLOMBIA. 9 | 10 | # Checks if a parameter is given 11 | INSTANCE_NAME=$1 12 | if [ -z ${INSTANCE_NAME} ] ; then 13 | INSTANCE_NAME=db2inst1 14 | else 15 | sed -i .bak 's/db2inst1/${INSTANCE_NAME}/g' ${DB2_RESP_FILE} 16 | fi 17 | 18 | cat ${DB2_RESP_FILE} 19 | 20 | # Creates the instance according to the response file. 21 | echo "Creating instance..." 22 | ${DB2_DIR}/instance/db2isetup -r ${DB2_CONF}/${DB2_RESP_FILE} 23 | 24 | -------------------------------------------------------------------------------- /db2-install/10.5/server_t/db2server_t_install.rsp: -------------------------------------------------------------------------------- 1 | PROD = DB2_SERVER_EDITION 2 | FILE = /opt/ibm/db2/V10.5 3 | LIC_AGREEMENT = ACCEPT 4 | INSTALL_TYPE = COMPACT 5 | COMP = APPLICATION_DEVELOPMENT_TOOLS 6 | -------------------------------------------------------------------------------- /db2-install/10.5/server_t/db2server_t_instance.rsp: -------------------------------------------------------------------------------- 1 | FILE = /opt/ibm/db2/V10.5 2 | INSTANCE = DB2_INST 3 | DB2_INST.NAME = db2inst1 4 | DB2_INST.TYPE = ESE 5 | DB2_INST.PASSWORD = db2inst1 6 | DB2_INST.UID = 501 7 | DB2_INST.GID = 501 8 | DB2_INST.GROUP_NAME = db2grp1 9 | DB2_INST.HOME_DIRECTORY = /home/db2inst1 10 | DB2_INST.SVCENAME = db2c_db2inst1 11 | DB2_INST.PORT_NUMBER = 50000 12 | DB2_INST.FCM_PORT_NUMBER = 60000 13 | DB2_INST.MAX_LOGICAL_NODES = 4 14 | DB2_INST.FENCED_USERNAME = db2fenc1 15 | DB2_INST.FENCED_PASSWORD = db2fenc1 16 | DB2_INST.FENCED_UID = 601 17 | DB2_INST.FENCED_GID = 601 18 | DB2_INST.FENCED_GROUP_NAME = db2fenc1 19 | DB2_INST.FENCED_HOME_DIRECTORY = /home/db2fenc1 20 | -------------------------------------------------------------------------------- /db2-install/10.5/server_t/download: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # URL to download the installer. The link is obtained from an article in the Wiki 4 | # https://github.com/angoca/db2-docker/wiki/db2-link-server_t 5 | # That article should contain a valid link as the last line. 6 | # If the link is not valid, you can modify the wiki. 7 | # 8 | # Version: 2016-05-15 9 | # Author: Andres Gomez Casanova (AngocA) 10 | # Made in COLOMBIA. 11 | 12 | LINK=$(curl --url https://raw.githubusercontent.com/wiki/angoca/db2-docker/db2-link-server_t-10.5.md -s | tail -1) 13 | # Download the installer. 14 | cd /tmp 15 | echo ${LINK} 16 | aria2c -x 16 ${LINK} 17 | 18 | -------------------------------------------------------------------------------- /db2-install/11.1/server_t/Dockerfile: -------------------------------------------------------------------------------- 1 | # This Docker file downloads the DB2 LUW binaries and installs them in the 2 | # image. It installs the necessary libraries. 3 | # 4 | # This Docker is designed to download the DB2 free edition from IBM and to 5 | # install DB2 from it. This edition does not requieres a license. 6 | # 7 | # Version: 2018-01-28 8 | # Author: Andres Gomez Casanova (AngocA) 9 | # Made in COLOMBIA. 10 | 11 | FROM ubuntu:16.04 12 | 13 | # MicroBadge 14 | ARG VCS_REF 15 | 16 | LABEL maintainer="angoca@yahoo.com" \ 17 | org.label-schema.build-date=${BUILD_DATE} \ 18 | org.label-schema.name="db2-docker-install" \ 19 | org.label-schema.description="Docker container for IBM DB2 for LUW with it already installed" \ 20 | org.label-schema.url="https://github.com/angoca/db2-docker/wiki" \ 21 | org.label-schema.vcs-ref=$VCS_REF \ 22 | org.label-schema.vcs-url="https://github.com/angoca/db2-docker" \ 23 | org.label-schema.vendor="AngocA" \ 24 | org.label-schema.version="1.0-11.1-install-ese" \ 25 | org.label-schema.schema-version="1.0" \ 26 | org.label-schema.docker.cmd="sudo docker run -i -t --privileged=true angoca/db2-install" 27 | 28 | # Set of variables to define the type of DB2 being installed. 29 | 30 | ## Version of the downloaded file. 31 | ENV DB2_VERSION=11.1 \ 32 | ## Mod of the downloaded file. 33 | DB2_MOD=2 \ 34 | ## Fixpack of the downloaded file. 35 | DB2_FIXPACK=2b \ 36 | ## Directory of the installers. Associated to the edition. 37 | DB2_INST_DIR=server_t \ 38 | ## Name of the response file for the installation. 39 | DB2_RESP_FILE_INSTALL=db2server_t_install.rsp \ 40 | ## Name of the response file for the instance creation. 41 | DB2_RESP_FILE_INSTANCE=db2server_t_instance.rsp \ 42 | ## Name of the script that downloads DB2. 43 | DB2_DOWNLOAD=download \ 44 | ## Script to create the instance 45 | DB2_INST_CREA_SCR=createInstance \ 46 | ## Directory for all scripts. 47 | DB2_CONF=/tmp/db2_conf 48 | ## Name of the downloaded file. 49 | ENV DB2_INSTALLER=v${DB2_VERSION}.${DB2_MOD}fp${DB2_FIXPACK}_linuxx64_${DB2_INST_DIR}.tar.gz \ 50 | ## Directory where DB2 is installed. 51 | DB2_DIR=/opt/ibm/db2/V${DB2_VERSION} 52 | 53 | # I N S T A L L A T I O N 54 | 55 | # Copies the script to download 56 | COPY ${DB2_DOWNLOAD} /tmp/${DB2_DOWNLOAD} 57 | 58 | # Copies the response file for the installation 59 | COPY ${DB2_RESP_FILE_INSTALL} /tmp/${DB2_RESP_FILE_INSTALL} 60 | 61 | # Test variables 62 | RUN echo "DB2_VERSION=${DB2_VERSION}" && \ 63 | echo "DB2_INST_DIR=${DB2_INST_DIR}" && \ 64 | echo "DB2_INSTALLER=${DB2_INSTALLER}" && \ 65 | echo "DB2_DIR=${DB2_DIR}" && \ 66 | # Run all commands in a single RUN layer to minimize the size of the image. 67 | # Updates Linux. Includes i386 68 | dpkg --add-architecture i386 && \ 69 | apt-get update && \ 70 | apt-get install -y \ 71 | aria2 \ 72 | curl \ 73 | libaio1 \ 74 | binutils \ 75 | file \ 76 | libx32stdc++6 \ 77 | numactl \ 78 | libpam0g:i386 && \ 79 | # Download the installer. 80 | ## URL to download the installer. The link is obtained from an article in the Wiki 81 | ## https://github.com/angoca/db2-docker/wiki/db2-link-server_t-11.1 82 | ## That article should contain a valid link as the last line. 83 | ## If the link is not valid, you can modify the wiki. 84 | echo ">>>Downloading..." && \ 85 | /tmp/${DB2_DOWNLOAD} && \ 86 | # Extract the installer and delete the tar file. 87 | echo ">>>Extracting..." && \ 88 | cd /tmp && \ 89 | tar -zvxf ${DB2_INSTALLER} && \ 90 | rm ${DB2_INSTALLER} && \ 91 | # Install DB2 and remove the installer. 92 | echo ">>>Installing..." && \ 93 | cd /tmp/${DB2_INST_DIR} && \ 94 | ( ./db2setup -r /tmp/${DB2_RESP_FILE_INSTALL} && \ 95 | cat /tmp/db2setup.log || cat /tmp/db2setup.log ) && \ 96 | echo ">>>Removing files..." && \ 97 | rm -Rf /tmp/${DB2_INST_DIR} && \ 98 | rm /tmp/${DB2_RESP_FILE_INSTALL} && \ 99 | # Removes the cache of apt-get and the unnecessary packages. 100 | # TODO The next line does not work in current version 101 | # apt -y autoremove aria2 curl && \ 102 | apt-get clean -y 103 | 104 | # I N S T A N C E 105 | 106 | # Creates a directory for all scripts 107 | WORKDIR ${DB2_CONF} 108 | 109 | # Copies the response file 110 | COPY ${DB2_RESP_FILE_INSTANCE} ${DB2_CONF}/${DB2_RESP_FILE_INSTANCE} 111 | 112 | # Copies the script to create the instance 113 | COPY ${DB2_INST_CREA_SCR} ${DB2_CONF}/${DB2_INST_CREA_SCR} 114 | 115 | 116 | -------------------------------------------------------------------------------- /db2-install/11.1/server_t/createInstance: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Helper to create an instance, start it and change to it. 4 | # This script could receive a parameter for the instance name. 5 | # 6 | # Version: 2018-01-28 7 | # Author: Andres Gomez Casanova (AngocA) 8 | # Made in COLOMBIA. 9 | 10 | # Checks if a parameter is given 11 | INSTANCE_NAME=$1 12 | if [ -z ${INSTANCE_NAME} ] ; then 13 | INSTANCE_NAME=db2inst1 14 | else 15 | sed -i.bak "s/db2inst1/${INSTANCE_NAME}/g" ${DB2_RESP_FILE} 16 | fi 17 | 18 | cat ${DB2_RESP_FILE} 19 | 20 | # Creates the instance according to the response file. 21 | echo "Creating instance..." 22 | ${DB2_DIR}/instance/db2isetup -r ${DB2_CONF}/${DB2_RESP_FILE} 23 | 24 | -------------------------------------------------------------------------------- /db2-install/11.1/server_t/db2server_t_install.rsp: -------------------------------------------------------------------------------- 1 | PROD = DB2_SERVER_EDITION 2 | FILE = /opt/ibm/db2/V11.1 3 | LIC_AGREEMENT = ACCEPT 4 | INSTALL_TYPE = COMPACT 5 | COMP = APPLICATION_DEVELOPMENT_TOOLS 6 | -------------------------------------------------------------------------------- /db2-install/11.1/server_t/db2server_t_instance.rsp: -------------------------------------------------------------------------------- 1 | FILE = /opt/ibm/db2/V11.1 2 | INSTANCE = DB2_INST 3 | DB2_INST.NAME = db2inst1 4 | DB2_INST.TYPE = ESE 5 | DB2_INST.PASSWORD = db2inst1 6 | DB2_INST.UID = 501 7 | DB2_INST.GID = 501 8 | DB2_INST.GROUP_NAME = db2grp1 9 | DB2_INST.HOME_DIRECTORY = /home/db2inst1 10 | DB2_INST.SVCENAME = db2c_db2inst1 11 | DB2_INST.PORT_NUMBER = 50000 12 | DB2_INST.FCM_PORT_NUMBER = 60000 13 | DB2_INST.MAX_LOGICAL_NODES = 4 14 | DB2_INST.FENCED_USERNAME = db2fenc1 15 | DB2_INST.FENCED_PASSWORD = db2fenc1 16 | DB2_INST.FENCED_UID = 601 17 | DB2_INST.FENCED_GID = 601 18 | DB2_INST.FENCED_GROUP_NAME = db2fenc1 19 | DB2_INST.FENCED_HOME_DIRECTORY = /home/db2fenc1 20 | -------------------------------------------------------------------------------- /db2-install/11.1/server_t/download: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # URL to download the installer. The link is obtained from an article in the Wiki 4 | # https://github.com/angoca/db2-docker/wiki/db2-link-server_t 5 | # That article should contain a valid link as the last line. 6 | # If the link is not valid, you can modify the wiki. 7 | # 8 | # Version: 2016-05-15 9 | # Author: Andres Gomez Casanova (AngocA) 10 | # Made in COLOMBIA. 11 | 12 | LINK=$(curl --url https://raw.githubusercontent.com/wiki/angoca/db2-docker/db2-link-server_t-11.1.md -s | tail -1) 13 | # Download the installer. 14 | cd /tmp 15 | echo ${LINK} 16 | aria2c -x 16 ${LINK} 17 | 18 | -------------------------------------------------------------------------------- /db2-install/expc/.dockerignore: -------------------------------------------------------------------------------- 1 | *.png 2 | README* 3 | -------------------------------------------------------------------------------- /db2-install/expc/Dockerfile: -------------------------------------------------------------------------------- 1 | # This Docker file downloads the DB2 LUW binaries and installs them in the 2 | # image. It installs the necessary libraries. 3 | # 4 | # This Docker is designed to download the DB2 free edition from IBM and to 5 | # install DB2 from it. This edition does not requieres a license. 6 | # 7 | # Version: 2018-01-28 8 | # Author: Andres Gomez Casanova (AngocA) 9 | # Made in COLOMBIA. 10 | 11 | FROM ubuntu:16.04 12 | 13 | # MicroBadge 14 | ARG VCS_REF 15 | 16 | LABEL maintainer="angoca@yahoo.com" \ 17 | org.label-schema.build-date=${BUILD_DATE} \ 18 | org.label-schema.name="db2-docker-install" \ 19 | org.label-schema.description="Docker container for IBM DB2 for LUW with it already installed" \ 20 | org.label-schema.url="https://github.com/angoca/db2-docker/wiki" \ 21 | org.label-schema.vcs-ref=$VCS_REF \ 22 | org.label-schema.vcs-url="https://github.com/angoca/db2-docker" \ 23 | org.label-schema.vendor="AngocA" \ 24 | org.label-schema.version="1.0-11.1-install-expc" \ 25 | org.label-schema.schema-version="1.0" \ 26 | org.label-schema.docker.cmd="sudo docker run -i -t --privileged=true angoca/db2-install" 27 | 28 | # Set of variables to define the type of DB2 being installed. 29 | 30 | ## Version of the downloaded file. 31 | ENV DB2_VERSION=11.1 \ 32 | ## Directory of the installers. Associated to the edition. 33 | DB2_INST_DIR=expc \ 34 | ## Name of the response file for the installation. 35 | DB2_RESP_FILE_INSTALL=db2expc_install.rsp \ 36 | ## Name of the response file for the instance creation. 37 | DB2_RESP_FILE_INSTANCE=db2expc_instance.rsp \ 38 | ## Name of the script that downloads DB2. 39 | DB2_DOWNLOAD=download \ 40 | ## Script to create the instance 41 | DB2_INST_CREA_SCR=createInstance \ 42 | ## Directory for all scripts. 43 | DB2_CONF=/tmp/db2_conf 44 | ## Name of the downloaded file. 45 | ENV DB2_INSTALLER=v${DB2_VERSION}_linuxx64_${DB2_INST_DIR}.tar.gz \ 46 | ## Directory where DB2 is installed. 47 | DB2_DIR=/opt/ibm/db2/V${DB2_VERSION} 48 | 49 | # I N S T A L L A T I O N 50 | 51 | # Copies the script to download 52 | COPY ${DB2_DOWNLOAD} /tmp/${DB2_DOWNLOAD} 53 | 54 | # Copies the response file for the installation 55 | COPY ${DB2_RESP_FILE_INSTALL} /tmp/${DB2_RESP_FILE_INSTALL} 56 | 57 | # Test variables 58 | RUN echo "DB2_VERSION=${DB2_VERSION}" && \ 59 | echo "DB2_INST_DIR=${DB2_INST_DIR}" && \ 60 | echo "DB2_INSTALLER=${DB2_INSTALLER}" && \ 61 | echo "DB2_DIR=${DB2_DIR}" && \ 62 | # Run all commands in a single RUN layer to minimize the size of the image. 63 | # Updates Linux. Includes i386 64 | dpkg --add-architecture i386 && \ 65 | apt-get update && \ 66 | apt-get install -y \ 67 | aria2 \ 68 | curl \ 69 | libaio1 \ 70 | binutils \ 71 | file \ 72 | libx32stdc++6 \ 73 | numactl \ 74 | libpam0g:i386 && \ 75 | # Download the installer. 76 | ## URL to download the installer. The link is obtained from an article in the Wiki 77 | ## https://github.com/angoca/db2-docker/wiki/db2-link-expc 78 | ## That article should contain a valid link as the last line. 79 | ## If the link is not valid, you can modify the wiki. 80 | echo ">>>Downloading..." && \ 81 | /tmp/${DB2_DOWNLOAD} && \ 82 | # Extract the installer and delete the tar file. 83 | echo ">>>Extracting..." && \ 84 | cd /tmp && \ 85 | tar -zvxf ${DB2_INSTALLER} && \ 86 | rm ${DB2_INSTALLER} && \ 87 | # Install DB2 and remove the installer. 88 | echo ">>>Installing..." && \ 89 | cd /tmp/${DB2_INST_DIR} && \ 90 | ( ./db2setup -r /tmp/${DB2_RESP_FILE_INSTALL} && \ 91 | cat /tmp/db2setup.log || cat /tmp/db2setup.log ) && \ 92 | echo ">>>Removing files..." && \ 93 | rm -Rf /tmp/${DB2_INST_DIR} && \ 94 | rm /tmp/${DB2_RESP_FILE_INSTALL} && \ 95 | # Removes the cache of apt-get and the unnecessary packages. 96 | # TODO The next line does not work in current version 97 | # apt -y autoremove aria2 curl && \ 98 | apt-get clean -y 99 | 100 | # I N S T A N C E 101 | 102 | # Creates a directory for all scripts 103 | WORKDIR ${DB2_CONF} 104 | 105 | # Copies the response file 106 | COPY ${DB2_RESP_FILE} ${DB2_CONF}/${DB2_RESP_FILE} 107 | 108 | # Copies the script to create the instance 109 | COPY ${DB2_INST_CREA_SCR} ${DB2_CONF}/${DB2_INST_CREA_SCR} 110 | 111 | 112 | -------------------------------------------------------------------------------- /db2-install/expc/README-short.txt: -------------------------------------------------------------------------------- 1 | 1. Downloads from IBM and installs IBM DB2 Express-C (11.1) including a script to create an instance. 2 | -------------------------------------------------------------------------------- /db2-install/expc/README.md: -------------------------------------------------------------------------------- 1 | ## Supported tags and respective `Dockerfile` links 2 | 3 | * [`expc`, `latest` (db2-install/expc/Dockerfile)](https://github.com/angoca/db2-docker/blob/master/db2-install/expc/Dockerfile) 4 | * [`11.1-ese`, `ese` (db2-install/11.1/server_t/Dockerfile)](https://github.com/angoca/db2-docker/blob/master/db2-install/11.1/server_t/Dockerfile) 5 | * [`10.5-ese` (db2-install/10.5/server_t/Dockerfile)](https://github.com/angoca/db2-docker/blob/master/db2-install/10.5/server_t/Dockerfile) 6 | 7 | ## What is DB2? 8 | 9 | IBM DB2 is a family of database server products developed by IBM. These products all support the relational model, but in recent years some products have been extended to support object-relational features and non-relational structures, in particular XML. 10 | 11 | Historically and unlike other database vendors, IBM produced a platform-specific DB2 product for each of its major operating systems. However, in the 1990s IBM changed track and produced a DB2 "common server" product, designed with a common code base to run on different platforms. 12 | 13 | * [wikipedia.org/wiki/IBM_DB2](https://en.wikipedia.org/wiki/IBM_DB2) 14 | * [DB2 LUW](http://www.ibm.com/analytics/us/en/technology/db2/) 15 | * [DB2 Express-C](http://www.ibm.com/software/data/db2/express-c/download.html) 16 | 17 | ![DB2 logo](https://raw.githubusercontent.com/angoca/db2-docker/master/db2-install/expc/logo.png) 18 | 19 | # What is a DB2 instance? 20 | 21 | A DB2 instance is a running process that controls the security at the higher level, listens on a specific port, controls the databases it hosts, and many other operations related to database administration. 22 | 23 | ## Set of images 24 | 25 | This image is part of a set of images to create your DB2 environment: 26 | 27 | * [db2-install: Downloads and installs DB2](https://registry.hub.docker.com/u/angoca/db2-install/) 28 | * [![](https://images.microbadger.com/badges/image/angoca/db2-install.svg)](https://microbadger.com/images/angoca/db2-install "Get your own version badge on microbadger.com") 29 | * [db2-db2inst1: Instance db2inst1 created](https://registry.hub.docker.com/u/angoca/db2-db2inst1/) 30 | * [![](https://images.microbadger.com/badges/image/angoca/db2-db2inst1.svg)](https://microbadger.com/images/angoca/db2-db2inst1 "Get your own image badge on microbadger.com") 31 | * [db2-sample: Database sample created (Without Dockerfile)](https://registry.hub.docker.com/u/angoca/db2-sample/) 32 | * [![](https://images.microbadger.com/badges/image/angoca/db2-sample.svg)](https://microbadger.com/images/angoca/db2-sample "Get your own version badge on microbadger.com") 33 | 34 | This is the stack of images: 35 | 36 | +-----------------+ 37 | | 3) db2-sample | <-- Sample database (db2sampl) 38 | +-----------------+ 39 | | 2) db2-db2inst1 | <-- Default instance created (db2inst1:50000) 40 | +-----------------+ 41 | | 1) db2-install | <-- DB2 Express-C installed 42 | +-----------------+ 43 | 44 | ## How to use this image 45 | 46 | This image has two parts: the installation of Db2, and the preparation for the instance creation. 47 | 48 | # Installation 49 | 50 | This image will download and install DB2 LUW Express-C, but it will not create an instance nor a database. 51 | 52 | NOTE: The [GitHub repository](https://github.com/angoca/db2-docker) has another Docker file that installs [DB2 Enterprise Server Edition](https://github.com/angoca/db2-docker/tree/master/db2-install/11.1/server_t) from the most recent fixpack; however, this installation requires a valid license after 90 days of usage. For this reason, this container is not published in the Docker Hub. 53 | 54 | The installer is obtained direclty from IBM; however, this link is temporal. If the link is not longer valid, you just need to modify a page of the [Wiki](https://github.com/angoca/db2-docker/wiki/db2-link-expc), by providing a new valid link. You just need to modify the link, by replacing the last line of the wiki. The instructions are in the same page, just visit: 55 | 56 | * [DB2 download link page in wiki Expc - 11.1](https://github.com/angoca/db2-docker/wiki/db2-link-expc) 57 | * [DB2 download link page in wiki ESE - 11.1](https://github.com/angoca/db2-docker/wiki/db2-link-server_t-11.1) 58 | * [DB2 download link page in wiki ESE - 10.5](https://github.com/angoca/db2-docker/wiki/db2-link-server_t-10.5) 59 | 60 | For the DB2 installation, a provided response file is used. You can clone this repository and modify the response file for your own needs. 61 | 62 | DB2 will be installed in the container in: 63 | 64 | For Express-C: 65 | 66 | /opt/ibm/db2/V11.1 67 | 68 | For ESE: 69 | 70 | /opt/ibm/db2/V11.1 71 | /opt/ibm/db2/V10.5 72 | 73 | Please, check the [Travis-CI execution](https://travis-ci.org/angoca/db2-docker) to see how this image is build. 74 | 75 | # Instance creation 76 | 77 | This image has a set scripts to ease the instance creation. The script that creates the instance follows the instructions of a response file. The instance by default is `db2inst1` listening on port 50000 installed in the `/home/db2inst1` directory. 78 | 79 | Please, check the [Travis-CI execution](https://travis-ci.org/angoca/db2-docker) to see how this image is build. 80 | 81 | # Build 82 | 83 | The build process can be done via a `pull` or directly from the sources via `build`. This will create the image that will be ready to run. 84 | 85 | Pull from Docker: 86 | 87 | sudo docker pull angoca/db2-install:latest 88 | 89 | Build from sources 90 | 91 | git clone https://github.com/angoca/db2-docker.git 92 | sudo docker build install/expc 93 | 94 | # Run 95 | 96 | The execution of a new container should be done in privilege mode, interactive with a seudo TTY. For example: 97 | 98 | sudo docker run -i -t --privileged=true --name="db2inst1" -p 50000:50000 angoca/db2-install 99 | 100 | The name of the container will be `db2inst1`. 101 | 102 | You can try the following line in order to not use privileged mode: 103 | 104 | sudo docker run -i -t --ipc="host" --cap-add IPC_LOCK --cap-add IPC_OWNER --name="db2inst1" -p 50000:50000 angoca/db2-install 105 | 106 | Once the container is running, the console is active under the `/tmp/db2_conf` directory. In this directory you will find a DB2 response file and a script to create an instance. The DB2 response file is configured to create a DB2 instance called `db2inst1` listening on port `50000`. If you want to change these or other properties, you just need to modify the response file or call the createInstance script with another username, for example: 107 | 108 | ./createInstance 109 | 110 | Or for a specific instance name 111 | 112 | ./createInstance myinst 113 | 114 | It will run `db2isetup`, and then you can change to the instance user and start the instance. Once there, you can create the database, or perform other configuration changes. 115 | 116 | Once you have finished the configuration, you can leave the container running by typing: 117 | 118 | Ctrl + P + Q 119 | 120 | # Local file system 121 | 122 | If you want to have an independent execution environment, a shared storage, you can mount a local directory in the images. It is recommended that you mount the `/home` directory and create all instances under this structure. This will store the home directories of the instances in the host, instead of in the containers. 123 | 124 | /home <-- /db2 locally in the host 125 | /db2inst1 <-- Home directory for instance db2inst1 126 | /db2inst2 <-- Home directory for instance db2inst2 127 | 128 | The previous distribution works only if you create different instance users across all containers. (It is not necessary to have one instance per container, but different instances across all containers when using host storage.) 129 | 130 | It is very important that you mount this file system before creating the instance. 131 | 132 | sudo mkdir /db2 133 | sudo docker run -i -t --privileged=true --name="db2inst1" -p 50000:50000 -v /db2:/home angoca/db2-instance 134 | 135 | NOTE: If you use automatic storage in DB2, and the database creation does not specify any path, the data will be also stored under `/home`. Instead, if you specify specific paths for your containers, make sure where they are stored (in the containers or in the host via mount). 136 | 137 | # Daemon 138 | 139 | Once the instance has been created, you can run the DB2 instance as a Docker daemon. 140 | 141 | sudo docker start 142 | 143 | Once the container with DB2 is running, it can be used to create, populate, manipulate and perform other activities with databases. 144 | 145 | If you want to access the console, you need to do an attach to the container 146 | 147 | sudo attach db2inst1 148 | 149 | ## Acknowledgements 150 | 151 | The design of this image is based on the following DB2-Docker images: 152 | 153 | * [grange74/docker-db2](https://github.com/grange74/docker-db2) - https://registry.hub.docker.com/u/grange74/db2/ 154 | * [bryantsai/db2-docker](https://github.com/bryantsai/db2-docker) 155 | * [jeffbonhag/db2-docker](https://github.com/jeffbonhag/db2-docker) 156 | * [miraitechno/db2](https://github.com/miraitechno/docker-db2) - https://registry.hub.docker.com/u/miraitechno/db2/ 157 | * https://registry.hub.docker.com/u/zongqiang/db2v10.5expc/ 158 | * [IBM IM C3ofC - DB2](https://github.com/IMC3ofC/db2express-c.docker) 159 | * [https://hub.jazz.net/project/cbmcgee/rtcdocker/overview](https://hub.jazz.net/project/cbmcgee/rtcdocker/overview#https://hub.jazz.net/project/cbmcgee/rtcdocker/cbmcgee%2520%257C%2520rtcdocker/_7MYIkF4LEeSi-OIwg-tlIA/_7Mut4F4LEeSi-OIwg-tlIA/db2/db/Dockerfile) Chris McGee 160 | 161 | And the posts of the following blogs: 162 | 163 | * [DB2 on Docker](https://bryantsai.com/db2-on-docker/) 164 | * [db2indocker](http://db2indocker.blogspot.com.co/) 165 | 166 | ## Advantages of these images 167 | 168 | The advantages to use this image instead of the other are: 169 | 170 | * The DB2 binary file is downloaded semi-automatically. The wiki has a valid link and this is the only thing that needs to be modified. The other images requiere to modify the image with a valid link or to have DB2 installer/binaries locally in the machine. 171 | * This image has a mechanism to create more instances with a simple script that uses a response file. The instance owner can have any name; it is not limited to `db2inst1` or something like `db2instX` where X is a number. 172 | * The environment can be configured in different ways. It is not limited to a fixed instance or database. The set of images provide different levels of flexible configuration. 173 | * The images are published in Docker in the `angoca` repository. The image is not created on the fly. The basic images are created from Dockerfiles, the last one was published in the repository with the database already created. As part of the publish, a corresponding documentation is provided. 174 | * The images can be found by performing a search in Docker. This allows to have a better visibility. 175 | * It was developed by a DB2 DBA. This makes this image appropriate not only for developers but also for DBAs and SysAdmins. 176 | * The complete installation and configuration is divided in different images. This makes the solution more flexible and easy to extent. 177 | * The image are based on recent versions. For example one of the last fixpacks in Db2 v10.5, and the most recent fixpack in v11.1. Also, a recent version of Linux Ubuntu is used; for v11.1 is used Ubuntu 16.04. 178 | * This image is based on a Linux distribution supported by IBM, which is Ubunut. CentOs is not supported. 179 | * There is documentation. This is very important for new users to understand the structure of the images. 180 | 181 | ## User Feedback 182 | 183 | # Issues 184 | 185 | If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/angoca/db2-dockers/issues). 186 | 187 | You can also reach the mainteiner via Twitter [@angoca](https://twitter.com/angoca). 188 | 189 | # Contributing 190 | 191 | You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. 192 | 193 | Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing. 194 | 195 | 196 | -------------------------------------------------------------------------------- /db2-install/expc/createInstance: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Helper to create an instance, start it and change to it. 4 | # This script could receive a parameter for the instance name. 5 | # 6 | # Version: 2018-01-28 7 | # Author: Andres Gomez Casanova (AngocA) 8 | # Made in COLOMBIA. 9 | 10 | RESP_FILE=db2expc_instance.rsp 11 | 12 | # Checks if a parameter is given 13 | INSTANCE_NAME=$1 14 | if [ -z ${INSTANCE_NAME} ] ; then 15 | INSTANCE_NAME=db2inst1 16 | else 17 | sed -i.bak "s/db2inst1/${INSTANCE_NAME}/g" ${RESP_FILE} 18 | fi 19 | 20 | cat ${RESP_FILE} 21 | 22 | # Creates the instance according to the response file. 23 | echo "Creating instance..." 24 | ${DB2_DIR}/instance/db2isetup -r ${DB2_CONF}/${RESP_FILE} 25 | 26 | -------------------------------------------------------------------------------- /db2-install/expc/db2expc_install.rsp: -------------------------------------------------------------------------------- 1 | PROD = EXPRESS_C 2 | FILE = /opt/ibm/db2/V11.1 3 | LIC_AGREEMENT = ACCEPT 4 | INSTALL_TYPE = CUSTOM 5 | COMP = DB2_SAMPLE_DATABASE 6 | -------------------------------------------------------------------------------- /db2-install/expc/db2expc_instance.rsp: -------------------------------------------------------------------------------- 1 | FILE = /opt/ibm/db2/V11.1 2 | INSTANCE = DB2_INST 3 | DB2_INST.NAME = db2inst1 4 | DB2_INST.PASSWORD = db2inst1 5 | DB2_INST.UID = 501 6 | DB2_INST.GID = 501 7 | DB2_INST.GROUP_NAME = db2grp1 8 | DB2_INST.HOME_DIRECTORY = /home/db2inst1 9 | DB2_INST.SVCENAME = db2c_db2inst1 10 | DB2_INST.PORT_NUMBER = 50000 11 | DB2_INST.FCM_PORT_NUMBER = 60000 12 | DB2_INST.MAX_LOGICAL_NODES = 4 13 | DB2_INST.FENCED_USERNAME = db2fenc1 14 | DB2_INST.FENCED_PASSWORD = db2fenc1 15 | DB2_INST.FENCED_UID = 601 16 | DB2_INST.FENCED_GID = 601 17 | DB2_INST.FENCED_GROUP_NAME = db2fenc1 18 | DB2_INST.FENCED_HOME_DIRECTORY = /home/db2fenc1 19 | -------------------------------------------------------------------------------- /db2-install/expc/download: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # URL to download the installer. The link is obtained from an article in the Wiki 4 | # https://github.com/angoca/db2-docker/wiki/db2-link-expc 5 | # That article should contain a valid link as the last line. 6 | # If the link is not valid, you can modify the wiki. 7 | # 8 | # Version: 2016-05-15 9 | # Author: Andres Gomez Casanova (AngocA) 10 | # Made in COLOMBIA. 11 | 12 | LINK=$(curl --url https://raw.githubusercontent.com/wiki/angoca/db2-docker/db2-link-expc.md -s | tail -1) 13 | # Download the installer. 14 | cd /tmp 15 | echo ${LINK} 16 | aria2c -x 16 ${LINK} 17 | 18 | -------------------------------------------------------------------------------- /db2-install/expc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angoca/db2-docker/d83274d7c930cf50ae869acebaa35143f1ea2e58/db2-install/expc/logo.png -------------------------------------------------------------------------------- /expc: -------------------------------------------------------------------------------- 1 | # Builds Express-C image 2 | docker build -t angoca/db2-install:expc db2-install/expc/ 3 | docker build -t angoca/db2-db2inst1:expc db2-db2inst1/expc/ 4 | docker images 5 | 6 | # Starts Express-C image 7 | echo ". /home/db2inst1/sqllib/db2profile;db2start" | docker run -i --ipc="host" --cap-add IPC_LOCK --cap-add IPC_OWNER --name="db2-db2inst1" -p 50000:50000 angoca/db2-db2inst1:expc 8 | 9 | docker ps -a 10 | 11 | # Starts the instance and creates a database. 12 | docker start $(docker ps -a -q) 13 | docker exec $(docker ps -a -q) su -c ". ~db2inst1/sqllib/db2profile ; db2start" db2inst1 14 | docker exec $(docker ps -a -q) su -c ". ~db2inst1/sqllib/db2profile ; db2 create db test" db2inst1 15 | docker exec $(docker ps -a -q) su -c ". ~db2inst1/sqllib/db2profile ; db2 connect to test" db2inst1 16 | 17 | 18 | -------------------------------------------------------------------------------- /images/Download1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angoca/db2-docker/d83274d7c930cf50ae869acebaa35143f1ea2e58/images/Download1.PNG -------------------------------------------------------------------------------- /images/Download2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angoca/db2-docker/d83274d7c930cf50ae869acebaa35143f1ea2e58/images/Download2.PNG -------------------------------------------------------------------------------- /images/Download3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angoca/db2-docker/d83274d7c930cf50ae869acebaa35143f1ea2e58/images/Download3.PNG --------------------------------------------------------------------------------