Getting the Image
Great news, during DockerCon 2017 Oracle announced support for Oracle 12.1 Database Docker images. Press release: Oracle Brings Oracle’s Flagship Databases and Developer Tools to the Docker Store
Previously to run an Oracle Database in a Docker container you needed to create your own Docker image, I actually Blogged on this earlier in the year, if you interested you can read about it here.
However, you can now obtain an official Oracle 12.1 Database Docker images from the Docker Store
Before you can ‘pull’ the new Docker image you will need to login to the Docker Store and click on the ‘Get Content’ button and then complete the form, providing your name, company, phone number and then accepting the Oracle license agreement.
The ‘Setup’ button provides details on how ‘pull’ the image and also how to set-up the your Oracle database within Docker.
docker pull store/oracle/database-enterprise:22.214.171.124
The Docker image includes all the required Oracle files so is pretty large coming in at ~4.87GB, so it may take a while to download.
Running the Container
The environment file allows for customisation of the Database name, password, domain and feature bundle.
The command for creating a database container is:
$ docker run -d –env-file -p :1521 -p :5500 -it –name –shm-size=”4g”
<path_to_env_file> is the path to the environment file you created using above example.
<listener_port> is the port on host machine to map the container’s 1521 port (listener port).
<http_port> is the port on host machine to map the container’s 5500 port (http service port).
<container_name> is the container name you want to create.
<shared_memory_size> is the memory size for the container to run. The minimum requirement is 4GB (–shm-size=”4g”).
<image_name> is the image that you use to create a container.
In this example our environment file is called db_env.dat and our container is going to be called dockerDB
docker run -d –env-file ./db_env.dat -p 1527:1521 -p 5507:5500 -it –name dockerDB –shm-size=”8g” store/oracle/database-enterprise:126.96.36.199
We should now be able to see our new Oracle 12.1 image and running container using:
docker image ls
docker container ls
From my MacBook Pro we check the progress of the build using the Docker logs option e.g.
docker logs -f dockerDB
We can also connect to the running container using the Docker exec command e.g.
docker exec -it dockerDB /bin/bash
From here we can see the Oracle Docker is using Oracle Linux 7.3 and the database is called ‘OraDoc’ as per our environment file.
As you can see from the above we are connected as root, if you want to use the oracle account then type ‘su – oracle’ and from there try out sqlplus inside your container.
Oracle 12c on an MBP Done!
[twitter-follow screen_name=’RonEkins’ show_count=’yes’]