15

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.

tyomka
  • 459
  • 2
  • 5
  • 14

2 Answers2

10

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.
Kilian
  • 1,753
  • 13
  • 21
  • 8
    Yes, this seems correct, just one refinement about Oracle's database versions: for 11g - ```-v /u01/app/oracle/oradata``` but for 12c - ```-v /opt/oracle/oradata``` – tyomka Dec 08 '17 at 08:20
3

Accepted answer is not correct for Oracle 11g XE, that is asked in this question.
"/u01/app/oracle" should be mapped with a volume (e.g. -v dbvolume:/u01/app/oracle)

nickolay.laptev
  • 2,253
  • 1
  • 21
  • 31