Let's try the official Oracle Docker container

Published on: Category: Oracle

A month ago Oracle released official Docker images for use by developers. The images are usable on any public cloud or on private, bare metal servers. Reason enough for me to take them for a spin.

Prerequisites

Note that the beauty of Docker means it doesn't matter which Linux distribution you use. It is recommended to make sure the kernel is fairly recent and a current version of Docker is installed. For this blog, I used an 8 GB RAM virtual private server offered by Digital Ocean, as they offer a one-click Ubuntu 17.04 deployment with Docker preloaded, and this option cost me $0.25 tops.

If you want to build your own virtual server locally and you use a RedHat or similar distribution, you might want to steal the script below. This is what I use for VirtualBox images I build with Vagrant.

  1. #!/bin/bash
  2.  
  3. # This script installs the latest version of docker on Oracle Linux 7
  4.  
  5. cat >/etc/yum.repos.d/docker.repo <<-EOF
  6. [dockerrepo]
  7. name=Docker Repository
  8. baseurl=https://yum.dockerproject.org/repo/main/oraclelinux/7
  9. enabled=1
  10. gpgcheck=1
  11. gpgkey=https://yum.dockerproject.org/gpg
  12. EOF
  13.  
  14. sudo yum update -y
  15. sudo yum install -y docker-engine
  16. sudo systemctl enable docker.service
  17.  
  18. sudo usermod -aG docker vagrant # Change this to your user
  19.  
  20. exit 0

I wanted a bit more memory for this experiment though, so I opted for the cloud.

Run Oracle in a container

After you secured a Docker account and a machine with a Docker Engine installed, it's time to start playing. Let’s start by opening an SSH session and verifying which Docker versions we are running for the client and server.

  1. root@OracleDockerTest:~# docker version
  2. Client:
  3. Version: 17.05.0-ce
  4. API version: 1.29
  5. Go version: go1.7.5
  6. Git commit: 89658be
  7. Built: Thu May 4 22:10:54 2017
  8. OS/Arch: linux/amd64
  9.  
  10. Server:
  11. Version: 17.05.0-ce
  12. API version: 1.29 (minimum version 1.12)
  13. Go version: go1.7.5
  14. Git commit: 89658be
  15. Built: Thu May 4 22:10:54 2017
  16. OS/Arch: linux/amd64
  17. Experimental: false

Ok, now that’s out of the way, we need to login. Normally when I pull a Docker container, it's an open source container on the Docker Hub which you can download without authentication. Oracle requires you to agree to their Oracle Technology Network License Agreement.

So, let’s do that:

  1. root@OracleDockerTest:~# docker login -u blangenberg
  2. Password:
  3. Login Succeeded

You now need to go to the Docker store and ‘purchase’ the image. This is free for development usage. Enter your details and accept the license agreement if you wish to do so.

When that’s done, it’s time to pull the image:

  1. root@OracleDockerTest:~# docker pull store/oracle/database-enterprise:12.1.0.2
  2. 12.1.0.2: Pulling from store/oracle/database-enterprise
  3. ac7c7887f8c8: Pull complete
  4. 81ec3f704f3a: Pull complete
  5. fd46874fc55d: Pull complete
  6. 8f5143a7a3c5: Pull complete
  7. 0ef133fdc901: Extracting [=======> ] 710.2MB/4.873GB

Trying to pull before you enter your details on the website will fail your pull. I tried to do this.

  1. root@OracleDockerTest:~# docker pull store/oracle/database-enterprise:12.1.0.2
  2. Error response from daemon: repository store/oracle/database-enterprise not found: does not exist or no pull access

The image is pretty big. At 5 GB, this is the biggest container I have ever downloaded.

  1. root@OracleDockerTest:~# docker pull store/oracle/database-enterprise:12.1.0.2
  2. 12.1.0.2: Pulling from store/oracle/database-enterprise
  3. ac7c7887f8c8: Pull complete
  4. 81ec3f704f3a: Pull complete
  5. fd46874fc55d: Pull complete
  6. 8f5143a7a3c5: Pull complete
  7. 0ef133fdc901: Pull complete
  8. Digest: sha256:9eab68c8857582d6aac6757b51a884e4c4f86f93e2f70815dd34004e15ec9b27
  9. Status: Downloaded newer image for store/oracle/database-enterprise:12.1.0.2
  1. root@OracleDockerTest:~# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. ubuntu latest ebcd9d4fca80 7 days ago 118MB
  4. ubuntu xenial ebcd9d4fca80 7 days ago 118MB
  5. ubuntu trusty 2ff3b426bbaa 7 days ago 188MB
  6. alpine latest 02674b9cb179 12 days ago 3.99MB
  7. **store/oracle/database-enterprise 12.1.0.2 235e2a33ea76 4 weeks ago 5.27GB**

We now need to prepare an environment file. The Oracle container will take the configuration specified in this file and use it to set up your container. Below you can find mine, which I hardly modified from the example the Docker store provides you with.

  1. ####################################################################
  2. ## Copyright(c) Oracle Corporation 1998,2016. All rights reserved.##
  3. ## ##
  4. ## Docker OL7 db12c dat file ##
  5. ## ##
  6. ####################################################################
  7.  
  8. ##------------------------------------------------------------------
  9. ## Specify the basic DB parameters
  10. ##------------------------------------------------------------------
  11.  
  12. ## db sid (name)
  13. ## default : ORCL
  14. ## cannot be longer than 8 characters
  15.  
  16. DB_SID=OraTest
  17.  
  18. ## db passwd
  19. ## default : Oracle
  20.  
  21. DB_PASSWD=MyPasswd123
  22.  
  23. ## db domain
  24. ## default : localdomain
  25.  
  26. DB_DOMAIN=ora.homecooked.nl
  27.  
  28. ## db bundle
  29. ## default : basic
  30. ## valid : basic / high / extreme
  31. ## (high and extreme are only available for enterprise edition)
  32.  
  33. DB_BUNDLE=basic
  34.  
  35. ## end

We are now ready for prime time.

  1. root@OracleDockerTest:~# docker run -d --env-file env -p 1521:1521 -p 5500:5500 -it --name OraTest --shm-size="6g" store/oracle/database-enterprise:12.1.0.2
  2. 7e041e72c7fe966e4a8c3822f6ac9e0f906b56eefdaf945e96e33da429003258

I was immediately able to connect using SQL Developer

Note that Enterprise Manager Express also worked out of the box but I was unable to use it. All three of my browsers said I had no Flash installed. I didn’t bother to investigate the issue.

With this article as a reference, I will be able to set up an Oracle development environment on DigitalOcean in about 15 minutes, which is the fastest option I have in my tool belt today. Pretty impressive and straight-forward!

Bas Langenberg
About the author Bas Langenberg

Bas Langenberg is a WebLogic and Oracle Fusion Middleware consultant.

More posts by Bas Langenberg
Comments (1)
  1. om 08:08

    Hi! Do you have any other post about using a database, created with docker, for local development? I mean like saving the database so that it does not vanish after stopping the container. Thanks.

Reply