Last week at Dockercon, Oracle announced that the Oracle Database is now available alongside other Oracle products the on Docker Store.
Given how much folks here in Silicon Valley (including my better half) rave about how easy and great Docker is, I thought I would try it out and share with you exactly how I did.
Oracle for Windows or Linux December 14, 2003 - 10:10 am UTC Reviewer: koth from Columbus, OH. If so is there production support for Oracle for the Mac OS? I need to design an application with a database component that has to work on both Windows and Mac OS. Oracle Database 10g Release 2 introduces database transport across the same. By adding Oracle as a service on your DSP, you can easily control which users and apps have access to the database and what level of access they should have. This blog post will show you the steps required to set up and make calls to an Oracle database from a DSP running on Mac OS X.
Since I was a Docker virgin, the first thing I had to do was download and install Docker. A quick trip to the Docker Store followed by a double click and I was up and running!
Next I needed to get the new Oracle Database container. You have two options here:
Go back to the Docker Store and search for “oracle database ”, which will return a Docker container that has a 12.1.0.2 database but is not a persistent image. That means if you drop the container the database disappears too. It’s also not possible to unplug the database from within the container and plug it in anywhere else.
Go to Github and get an Oracle Docker build files and then go to Oracle.com and get the 12.2 database software. This combination will allow you to create a Docker container that has the latest 12.2 database and is persisted. That is to say if the container is dropped you still have the database and it is possible to unplug the database and plug it in somewhere else.
I chose to go with option 2, which is a wee bit more involved but having 12.2 and a persistent image were both, very important to me. And before you ask, yes 12.2 will be made available in the Docker Store and it will be persistent. It’s just not there yet.
The steps below explain exactly what I did (with some help from @GeraldVenzl)
1. Go to https://github.com/oracle/docker-images and download the Oracle Docker build files. 2. Go to http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html and download Oracle Database 12c Release 2 for Linux x86-64.
3. You should now have two files: i. docker-images-master.zip ii. linuxx64_12201_database.zip
Unzip the docker-images-master.zip file, which will result in a new directory called docker-images-master. This directory contains 12 subdirectories, one of each of the Oracle products supported on Docker.
4. Copy the 12.2 software (linuxx64_12201_database.zip) into the /docker-images-master/OracleDatabase/dockerfiles/12.2.0.1 subdirectory.
5. Next you need to create the Docker image. I took the easy route and utilized the buildDockerImage.sh shell script, which is included in docker-images-master.zip. It will create an image using oraclelinux:7-slim and which ever database version you specify. I used the following command to install Oracle Database 12.2 software:
Note the installer reaches out the internet to get oraclelinux:7-slim and to do a yum update of the OS inside the container, so if you are doing this behind a corporate firewall you will need to explicitly set the environment variable https_proxy. The buildDockerImage.sh script will automatically detect http_proxy and https_proxy and pass it on to Docker to use for the image build.
6. Once the image is built you can check what you have by running the “docker images” command
As you can see I have installed, Oracle Linux and the Oracle Database 12.2.0.1 software. We don’t have a database yet.
7. In order to get an actual database, we need to create our first container. I used the “docker run” command below to do this and supplied a couple of additional parameters for mappings since I wanted to persist the database files even if the container was removed.
–name Gave the new container the name “oracle” (will be auto genearted if omitted) -p Mapped port 1521 and 5500 on my laptop to the corresponding ports inside the container -v Mapped my local directory (/Users/mcolgan-mac/oradata ) to the default location where the data files will be stored (:/opt/oracle/oradata) to ensure the files are persisted outside my container.
8. The “docker run” command actually calls the Oracle DBCA and automatically creates a database. Since this is a 12c database it will automatically create a container database ORCLCDB and one pluggable database ORCLPDB1 (both can be overwritten if you wish). I didn’t specify a password for the SYS, SYSTEM or PDBADMIN accounts in my command, so one was automatically generated for me and displayed in the output of the command. Be sure to change the password from this default. You can do this using the “docker exec” command once your database is up and running.
9. We can confirm our container was created successfully and is running by using the “docker ps” command.
10. Going forward all we need to do is start and stop the container, which will open and close the database.
You can monitor exactly what is going during these commands by looking at the docker logs using the docker log command.
So there you have it, ten simple steps to get you up and running with Oracle Database 12.2 on Docker. If you want more details on building Oracle Database Docker images, check out Gerald’s blog.
Related
A few semester back I finished database design course at university. While the theory part was all about database design the lab part focused more on database manipulation. Or in simpler words it was all about SQL. Now if you want an RDBMS software what choices do you get? A lot! Oracle, Microsoft SQL Server, MySQL etc etc. The list will just rage on these days. Our lab instructor however insisted on using Oracle, and that bugged me out because I carry a macbook to the lab for lab works and – there’s no MacOS version by Oracle for the Oracle Database Express. But, we’re in the age of VM’s and who cares what OS you’re using? Use a VM, job done! Now should you install an entire OS on VM for that? Well, it’s overkill. That’s why Docker comes in, it creates a Linux VM where you can deploy install test and do whatever you want with your applications. The overhead is really negligible as if you’re natively running Oracle Server on your machine. Let’s see how to install Oracle Database Express 11g on your shiny Mac via Docker.
What you need
Your Mac(iMac, Mac Mini, Mac Pro, Macbook Pro, Macbook Air or whatever Mac Apple is going to release after I publish this post)
Make sure your machine has enough RAM to power a VM. Anything above 4GB is fine.
Make sure again you’re running the Latest Version of MacOS
Docker Toolbox + Kitematic
And yes you need some time. Grab some coffee or Doritos if you want to.
First : Download Docker Toolbox and install it
Download Docker Toolbox + Kitematic dmg form this LINKÂ . You know how to install from dmg images on your mac so I’m just skipping this part.
A note : MacOS may block the installer from running saying it’s unidentified. Just allow it from “Security and Privacy” in System Prefs.
Open Kitematic
Docker is a command line based tool and we don’t want to get pinned down with large commands, Kitematic, with it’s GUI makes life easier for us and helps completely forget that Docker needs cli. At least for our purpose!
If Docker shows some error like it’s unable to create the VM, install Oracle Virtual Box. A quick google will give you the link. First time installation will take a while so have patience. You’ve coffee and Doritos right?
When it’s ready you’ll get this Window. You can create an account if you want, or skip for now. I’d suggest opening an account. Has some benefits.
Next Part : Download and install Oracle Database Express 11g Image
You don’t need to look further! Just type in the name and Kitematic will find out the image for you(if it’s available).
Well well, a lot of choices , I mean images. So which one to choose? I’ll go with the marked one (because I’ve used it, tested, works.) – created by “wnameless”. Click on create and let the wait flow through you. Kitematic will download and install the image for you. Easy. You just need to wait.
Aaaaaaaaand we’re ready!
Kitematic has done the hardwork for us, now it’s time to get to work.
Which Oracle Database Should I Download For Mac
Now we need to start the server. Just click on start. Wait Until you see Unauthorized in Web Preview. The server needs some time to set in. Once you see it, click on the button beside right to web preview.
Oracle Database Express will now open in your system default web browser. You can copy paste the address to another browser if you want to!
Now you need a username and password. As the Docker image doc goes, you need to use these credentials.
username : system password : oracle
!!!!ISSUES!!!!!
Now this should be working pretty nice but it doesn’t. From my experience I’ve found that you can’t login this way. What you need to this , enter the credentials and when it asks again for credentials , cancel it, then refresh the page. It works this way. If you find a workaround, feel free to leave a comment. May help others (and me too!)
Hail the Oracle Database
So we’re in and this is what Oracle Database system looks. Now what happens if you accidentally close the window? No problem, just open it from Docker again. Funny thing is , this time it won’t bother you with that login issue.
Let’s create an user and configure system admin for database
You now need an user account to work with the database and also need admin privilege to create user and workspaces for them. Now who’s the admin? You’re, and you’ve the login credentials we mentioned above.
Click on Application Express to begin with. Login with username : system and password : oracle.
For first time use, create a new user, a database and give the user  a password. Now what if you’ve worked for some time then logged out and want to get back where you left off. Follow the instruction the the image, click on that button, enter the username and password you used when creating the user and you should be right back where you left off. Cool!
Wrapping up
So let’s just wrap it. It was a long procedure, I hope you didn’t run out of coffee and Doritos.