Informix

Test/DevSystem with Docker

By Pradeep Natarajan posted Mon May 13, 2019 06:42 PM

  

One of the key benefits of using docker is the simplicity, portability and immutable nature of a docker image.  You may have a need to use the docker image and configure the IBM Informix instance to your specific requirements and create any database/tables you need.  This can easily be accomplished for development and testing purposes using the IBM Informix Developer Edition docker image on Docker Hub. 

 

Follow the steps listed below:


Pull Docker Image

The IBM Informix Developer Edition is made available on http://dockerhub.com.  It is in the ibmcom organization and can be pulled using the following docker command.

docker pull ibmcom/informix-developer-database

This will be the base image that you use to create your test docker image.



Start & Modify Container

Start the Docker Container using the following command.

docker run –name server -e LICENSE=accept -e LOCAL=true        -p 9089:9089 ibmcom/informix-developer-database

It is important that you use the -e LOCAL=true option.  This will cause the container to store all data, dbspaces and chunks inside the container.  We’ve named the container server and that name is used in other Docker commands.

Now connect to the Running container and make any changes needed.  Create Databases, add dbspaces and chunks as necessary.  Create any new chunks and dbspaces in the same location as the rootdbs.  Do NOT store any data in /opt/ibm/data.  This directory is intended for use with volume storage and is not be maintained inside the container. 


Use the command below to open a shell in the running container.

docker exec –it server bash

 

Commit Container  

After creating your databases and making all changes to the running container you need to commit those changes to a new image.  First Take the Database offline by running the following inside the container.

onmode -ky

Next outside the container on the host run the following to commit the image.  Here we’ve given the new image a name ifx-test:v1.

docker commit server ifx-test:v1

 

Save Image

You now have an image named ifx-test:v1 in your Docker environment that is ready to be used.  To make this image portable you need to save it to a tar file.  Run the following Docker command to save your newly created image to a tar file(ifx-test.tar) for portability.

docker save -o ifx-test.tar ifx-test:v1

 

Load & Run

To load the tar file (Docker image) run the following command.

 docker load -i ifx-test.tar

This command will load the image into the docker environment and will now be seen with the docker images command.

You can now run the newly loaded image with the following run command.

docker run –name server -e LICENSE=accept -p 9089:9089 ifx-test:v1


More Information

For more information regarding the IBM Informix Docker image and exposing other ports see the README.md at https://hub.docker.com/r/ibmcom/informix-developer-database

 

0 comments
15 views

Permalink