A dockerized OpenDJ server.
# create a data container to persist opendj data to
docker run --name opendj_data_1 socrata/data
# Create DS backend persisted to the data container
docker run -e "BASE_DN=dc=mycompany,dc=com" --volumes-from opendj_data_1 socrata/opendj configure
# Now launch the directory service in a container
docker run socrata/opendj
It's probably more manageable to generate a config.ldif, and inject all this into a simple Dockerfile and build your own image:
FROM socrata/opendj
# Generated by creating a backend and setting any dsconfig attributes
ADD config.ldif /opt/opendj/config/
# Any custom schemas?
ADD 99-my-custom-schema.ldif /opt/opendj/config/schema
# Set the BASE_DN environment var for future management simplicity
ENV BASE_DN dc=mycompany,dc=com
The simplest aproach is to import remotely (e.g. via Apache Directory Studio). Alternatively, you can import LDIFs by injecting them into the data container:
# Add LDIFs to /data/opendj/ldif/
cat sample.ldif | docker exec -i opendj_data_1 sh -c 'cat > /data/opendj/ldif/sample.ldif'
# Any LDIFs in /data/opendj/ldif/ will be imported by running:
docker run -t -i --rm --volumes-from opendj_data_1 socrata/opendj import
# or simply: bin/run opendj import
A few wrappers simplify the build/run steps to iterate quickly
bin/build [service] # Build the docker image(s)
bin/run [service [args]] # Run the service in a docker container
# Example: importing LDIFs in the data container is as easy as:
bin/run opendj import
Troubleshooting a container begins by using shell
as the arg:
# Example: Launch a shell in the opendj container
bin/run opendj shell
# From the shell, you can run the default docker run command via:
/start [ACTION]
When run via Boot2Docker, opendj requires increasing the VM's file descriptor limit:
echo "ulimit -n 10240" | sudo tee -a /var/lib/boot2docker/profile