Create Oracle Docker image with custom data Create Oracle Docker image with custom data oracle oracle

Create Oracle Docker image with custom data


Didn't get that approach to work. I decided to run a official image, modify the database and create an own image out of that modified container.

UPDATE: The official Dockerfiles are available on GitHub, I used the one for a single instance DB installation. Well, Dockerfile might be some kind of misleading. You will get a Dockerfile bundled with some scripts. Once you downloaded an official setup file from the Oracle (these seem to be correct) and put it in the right place, you can

  • start to create a Docker image (see README on linked GitHub page)
  • run your newly created image (docker run --name ora -e ORACLE_PWD=<yourpw> <image name/id, e. g. oracle/database:18.4.0-xe>)
  • use "sqlplus" in your container to create some data
    • docker exec -it ora bash
    • bash-4.2# sqlplus sys/<yourpw>@localhost:1521/XEPDB1 as sysdba
  • exit "sqlplus" and the "bash"
  • stop the container (docker stop ora)
  • commit the changes (docker commit -m "Oracle XE + custom changes" -a "<Your name>" ora <registry>/<nameForTheChangedImage>)