TIP: How to Persist OpenDJ Docker Container Data Between Restarts - OpenIdentityPlatform/OpenDJ GitHub Wiki

If you want persist the OpenDJ configuration data, you need to specify a volume that maps /opt/opendj/data container directory to a local directory. Example with docker-compose.yaml

services:
  opendj:
    image: openidentityplatform/opendj:latest
    ports:
      - 1389:1389 
      - 1636:1636 
      - 4444:4444
    volumes:
      - ./opendj-data:/opt/opendj/data

With docker run command:

docker run -h ldap-01.domain.com \
    -p 1389:1389 -p 1636:1636 -p 4444:4444 \
    --name ldap-01 \
    -v ./opendj-data:/opt/opendj/data \
    openidentityplatform/opendj