I started the 12.1 Community Edition server in a container and it works fine as long as the container is not stopped. db2stop and db2start inside the container work fine, but if I stop the container and try to start it again, it fails and the following errors are logged in the db2icrt.log.nnn
ERROR: DBI20187E The fencedid file "/database/config/db2inst1/sqllib/adm/fencedid" is invalid because it is not owned by the "root":"db2iadm1". Change the ownership of the fencedid file to be owned by the "root":"db2iadm1" and then rerun the command.
ERROR: An error occurred while configuring the instance "db2inst1".
I compared the setup_db2_instance.sh files from 11.5.8.0 and 12.1.0.0 images and they match. Only the dates are different: Mar 30 2023 and Oct 24 2023, respectively.
I fixed the problem by copying the setup_db2_instance.sh file to the host and modified it as shown below, and then injected the file back into the container before stopping it. Then the restart works fine.
docker cp db2test:/var/db2_setup/lib/setup_db2_instance.sh setup_db2_instance.sh
edit the file by adding the command:
chown root:db2iadm1 /database/config/db2inst1/sqllib/adm/fencedid
docker cp setup_db2_instance.sh db2test:/var/db2_setup/lib/setup_db2_instance.sh
The host is Rocky Linux 9.5 (Blue Onyx) and the container is started with the following:
docker run \
--name db2test \
--hostname db2test \
--detach \
--env-file=.env_121 \
--privileged=true \
--volume /dockerdata/db2test:/database \
--publish=52000:50000 \
icr.io/db2_community/db2:12.1.0.0
The .env_121 file is:
LICENSE=accept
DB2INSTANCE=db2inst1
DB2INST1_PASSWORD=password
DBNAME=SANDBOX
BLU=false
ENABLE_ORACLE_COMPATIBILITY=false
UPDATEAVAIL=NO
TO_CREATE_SAMPLEDB=false
REPODB=false
IS_OSXFS=false
PERSISTENT_HOME=true
HADR_ENABLED=false
ETCD_ENDPOINT=
ETCD_USERNAME=
ETCD_PASSWORD=
------------------------------
Tapio Kuisma
------------------------------