Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14197

Oracle on Docker with pre-pumped Data

I am using the following base docker file:

https://github.com/wnameless/docker-oracle-xe-11g/blob/master/Dockerfile

I read a bit on how to setup a data Volumne from this SO question and this blog, but not sure how to fit the pieces together.

In short, I would like to manage the oracle data in a data only Docker image, how to do it ?

Upvotes: 8

Views: 4455

Answers (3)

Sath89
Sath89

Reputation: 392

I've realized volumes mount for db data. Here is my fork:

  • Reduce size of image from 3.8G to 825Mb
  • Database initialization moved out of the image build phase. Now database initializes at the containeer startup with no database files mounted
  • media reuse support outside of container. Added graceful shutdown on containeer stop
  • Removed sshd

You may check here:

https://registry.hub.docker.com/u/sath89/oracle-xe-11g

https://github.com/MaksymBilenko/docker-oracle-xe-11g

Upvotes: 5

Rondo
Rondo

Reputation: 3721

I tried mapping the datafiles and fast recovery directories in my oracle xe container. However, I changed my mind after losing the files ... so you should be very careful about this approach and understand how docker manages those spaces under all operations.

I found, for example, that if you clean out old containers, the contents of the mapped directories will be deleted even if they are mapped to something outside the docker system area (/var/lib/docker). You can avoid this by keeping containers and starting them up again. But, if you want to version and make a new image... you have to backup those files.

Oracle also id's the files themselves (checksum or inode # or something) and complains about them on startup.... I did not investigate the extent of that issue or even if there is indeed any issue there.

I've opted to not map any of those files/dirs and plan to use datapump or whatever to get the data out until I get a better handle on all that can happen.

So I update the data and version the image... pushing to to the repo for safe-keeping

Upvotes: 2

Usman Ismail
Usman Ismail

Reputation: 18679

In general:

# Start data container
docker run -d -v /dbdata --name dbdata -it ubuntu

# Put oracale data in /dbdata some how

# Start container with stabase and look for data at /dbdata
docker run -d --volumes-from dbdata --name db -it ubuntu

Upvotes: 0

Related Questions