Search code examples
dockeroracle11gpersistencevolume

Persisting data in docker's volume for Oracle database


I created volume for storing my application database data - docker volume create dbvolume.

Then I launched my docker container with Oracle XE 11g database image and data volume.

docker run --name=OracleXE --shm-size=1g -p 1521:1521 -p 8080:8080 -e ORACLE_PWD=weblogic1 -v dbvolume:/opt/oracle/oradata oracle/database:11.2.0.2-xe

Stored some entries in database. Stopped and removed container then launched it again, but no data persisted in database.

How can I get persisted data on subsequent requests to application.


Solution

  • from https://github.com/oracle/docker-images/tree/master/OracleDatabase

    -v /opt/oracle/oradata
                  The data volume to use for the database.
                  Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
                  If omitted the database will not be persisted over container recreation.