How to Persist OpenIDM Configuration Data Between Restarts

If you need to persist OpenIDM configuration data between container restarts you need to mount the following directories

Directory Description

/opt/openidm/conf

OpenIDM configuration files storage

/opt/openidm/db

OpenIDM database location in case you are using OrientDB (default DB)

/opt/openidm/logs

OpenIDM logs

/opt/openidm/security

OpenIDM keystore, trust store and realm configuration

But these directories except /opt/openidm/logs contains files, so you need to create a copy of pre-existing data:

Run the following commands:

mkdir -p openidm-data/logs
docker create --name tmp-openidm openidentityplatform/openidm
docker cp tmp-openidm:/opt/openidm/conf ./openidm-data/conf
docker cp tmp-openidm:/opt/openidm/db ./openidm-data/db
docker cp tmp-openidm:/opt/openidm/security ./openidm-data/security
docker rm tmp-openidm
sudo chown -R 1001:1001 ./openidm-data

Then you can mount the data.

With docker-compose.yaml file

services:
  openidm:
    image: openidentityplatform/openidm:latest
    volumes:
      - ./openidm-data/conf:/opt/openidm/conf
      - ./openidm-data/db:/opt/openidm/db
      - ./openidm-data/logs:/opt/openidm/logs
      - ./openidm-data/security:/opt/openidm/security
    ports:
      - "8080:8080"

With docker run command:

docker run -h idm-01.domain.com \
    -p 8080:8080 -p 8443:8443 \
    --name idm-01 \
    -v ./openidm-data/conf:/opt/openidm/conf \
    -v ./openidm-data/db:/opt/openidm/db \
    -v ./openidm-data/logs:/opt/openidm/logs \
    -v ./openidm-data/security:/opt/openidm/security \
    openidentityplatform/openidm