Db2 uses containers to physically store data. A Db2 container can be a file, a directory, or a raw device. Since Db2 containers are objects that actually exist on a disk or a raw device, they are considered as physical database objects. In contrast to containers, tablespaces are logical database objects. There are two different ways that are usually used to take the kinds of Db2 containers and how they are used in other database platforms.

Community Edition Container from Docker Hub for Db2 container

This container requires privileged access (think root for Docker/K8’s) and only allows one to run on any of the given host/node, so it is therefore not something you’re going to use for most shared environments. This container may include features you don’t use, and may take longer to spin up as a result. I’ve tried several times with using this container as a starting point and building customizations on top of it.

Create Your Own

At a huge level, you simply build docker files and entry point scripts that create a container as you need it to be. We reuse the scripts called by an entry point script in our Cloud formation templates to make sure the same standards are in place no matter where a database environment lives. Db2 is not fully supported on custom containers, they can require you to reproduce a problem on hardware to prove that the issue lies with Db2.

Ways Db2 Containers are Commonly Used

Replacing Database Servers in Production and Non-Production Environments

It is important to think about your platform and your requirements when deciding what to run in containers and what not to. Things like patching also require a different process, so I highly recommend that if your production is not in containers, you have at least one non-prod environment in containers.

Sandboxes for Developers

It’s like an easy stretch from running anything in containers to having a developer container that developers can use on their local environment, the first is that if you have a custom image that includes a license for your other containerized environments, you’ll need to be sure you handle licensing appropriately on the developer locals so you don’t violate the licensing agreement.

Sandboxes for DBAs

Understanding some of these basics of containers is useful in a DBA’s career. We have more and more demands to containerize databases and to assist developers with their containerized environments. Even if the only way you use containers is for your own sandbox environments, they’re still ridiculously easy to use.

Database Maintenance

After many changes to table data that are caused by the insertion, deletion, and updating of variable length columns activity, logically sequential data might be on non-sequential physical data pages. Because of that, the database manager performs extra read operations to access data. Db2 containers are executable units of programming in which application code is bundled, alongside its libraries and conditions. Db2 containers are an abstraction in the application layer, whereby code and dependencies are compiled or packaged together. It is possible to run multiple containers on one machine.

Connect with us to better manage your Db2 containers.