A while ago, I had to work in a project that used oracle as its data layer (yeah, I know...). When we started, there was no such thing as an Oracle docker image so the development environment was either set-up manually or using bash scripts. I tried to create images but, first, it was hell and, second, I didn't want to bother with any license breach. I love bash and I'm often scripting away repetitive stuff but I am way too used to docker for my development environments (and also for deploying and in production); as such, it can be said that, whenever I had to rebuild the environment from scratch (and since a migration was being made towards data warehouses, that was more often than usual), I cursed my days.
Thankfully, by the time we were finishing and regressions were becoming more and more expected, Oracle released
official images to the docker store. I didn't waste time and, with some effort as the documentation
was quite sparse, I managed to set them up locally and turned the bash scripts (and some plain
text instructions) and other requirements into a
docker-compose file. This short guide is about duplicating
the process (well, the Oracle part).
First of all, create an account in the docker store if you don't have one already.
Next, login with your account in the docker console, using the command
With that set up, head over to the oracle enterprise page in the docker store and click in the button that says "Proceed to Checkout".
At this point, fill the information requested and accept the terms, the process is similar to the one Oracle has for downloading the client and databases from their website. They require it here too because this is Oracle.
Now you can pull the docker image:
docker pull store/oracle/database-enterprise:18.104.22.168. It'll take a while.
At this point you're probably in the instructions page, which is now far more detailed than it was when the images were released, lucky you. They are relatively easy to follow but I'll write the last few commands required to use the image here anyway.
To start the image, run the command:
docker run -d --name <db-container-name> \ store/oracle/database-enterprise:22.214.171.124
To connect to the database using Oracle's sqlplus client, use the following command:
docker exec -it <db-container-name> bash -c \ "source /home/oracle/.bashrc; sqlplus /nolog"
- Setting the
DB_SIDenvironment variable changes the name of the database. Default is
- The port
1521can be mapped so that the container can be accessed from the host. It can also, of course, be linked or set up in a network with other containers.
- The data can be separated in a volume, the directory to be mapped is
- Remember to change the password of the
sysuser (default is
Oradoc_db1). This probably should be done in a Dockerfile that uses this image as base.
- There's a smaller image (
store/oracle/database-enterprise:126.96.36.199-slim) whose Oracle installation has fewer options and tools. This is what I'd probably use if I have to work with Oracle again.
And that's it for now. If you have any problems or corrections, let me know in the comments!