docker-oracle-xe-11g icon indicating copy to clipboard operation
docker-oracle-xe-11g copied to clipboard

Add volume to get data outside the container

Open jmaister opened this issue 10 years ago • 9 comments

jmaister avatar Sep 25 '15 22:09 jmaister

Is there any way to do this?

felipear89 avatar Sep 29 '15 13:09 felipear89

There is a solution in fork of this project: https://github.com/MaksymBilenko/docker-oracle-xe-11g

MaksymBilenko avatar Dec 02 '15 18:12 MaksymBilenko

Please add VOLUME /u01 to the Dockerfile. A Database which loses all data on restart is quite pointless. Mariadb/Mysql do the same in their images.

atamanroman avatar Dec 09 '15 16:12 atamanroman

@atamanroman This is not going to work. There is a tricky dependencies.

  • If you would add VOLUME /u01 - database wouldn't start cause of there would be no DB installation in there.
  • And if you would mount only oradata folder - this is not going to work cause of Oracle requires DB configuration that stores on the different folder.

Here is an example of working solution in entrypoint: On the Docker build image step do this:

mv /u01/app/oracle/product /u01/app/oracle-product

On the entrypoint:

rm -f /u01/app/oracle/product       #Just to make sure that there is no files
ln -s /u01/app/oracle-product /u01/app/oracle/product    #Mound database installation to the Expanded VOLUME of container

ln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/xe/dbs    #Link db configuration to the installation path form extended volume with DB data

And then start DB. you can take a look on the implementation of this by link on my previous comment

MaksymBilenko avatar Dec 09 '15 16:12 MaksymBilenko

I made /u01 a volume and everything seems to work fine. Data is persisted between container restarts. Why would there be no DB installation in that folder if it was a volume?

VOLUME /u01 does not empty that folder. On initial container start all content in /u01 is copied into the volume. That's exactly the same default mariadb/mysql provides. I don't see the problem (but there might be one I don't see?).

atamanroman avatar Dec 09 '15 17:12 atamanroman

Add volume when running the container. docker run --name oracle11g -d -p 49161:22 -p 1522:1521 -p 49163:8080 -v /oracle11g-data/:/u01/app/oracle/oradata/oracle11g-data/ -e ORACLE_ALLOW_REMOTE=true --restart=always wnameless/oracle-xe-11g

dragonbest520 avatar Sep 08 '17 16:09 dragonbest520

Hi @dragonbest520, I'm setting the volume the same way as you do, but when I check the folder /oracle11g-data/ on the host machine is empty do you know what the problem is?

cbdavide avatar Jan 29 '19 20:01 cbdavide

Hi @cbdavide @dragonbest520 For me /oracle11g-data/ is also empty. Did you solve it? Why would we mount /oracle11g-data/ if Oracle data (tables) are not stored there?

mikperic avatar May 08 '20 13:05 mikperic

For me /oracle11g-data/ is also empty ~~ @cbdavide @dragonbest520

liangwenzhong avatar Nov 20 '20 04:11 liangwenzhong