docker-oracle-xe-11g
docker-oracle-xe-11g copied to clipboard
Add volume to get data outside the container
Is there any way to do this?
There is a solution in fork of this project: https://github.com/MaksymBilenko/docker-oracle-xe-11g
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 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
oradatafolder - 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
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?).
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
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?
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?
For me /oracle11g-data/ is also empty ~~ @cbdavide @dragonbest520