Today I added few more utilities to my oracle linux 7 with utilities docker image.
New additions are: jdk 1.8 and groovy 2.4.8
To pull you can use
docker pull vikceo/oraclelinux7withutils
Enjoy!
Thursday, February 16, 2017
Oracle Linux 7 docker image update
Labels:
docker,
docker hub,
groovy,
image,
jdk8,
linux,
oracle linux 7
Friday, February 10, 2017
Docker for Beginners
Docker is the hottest celebrity in the tech World. Everyone around you might be jumping over it. And you might wonder what the hype is about?
In simplest form, I would say it is much like a virtulbox or vm but very light weight. Reason? It eliminates an entire OS layer and uses most of the required components from the host OS. I would let you read more firm definition from official docker documentation
I started playing with it very recently and thought to put up some very basic getting started steps. I am using a mac pro with Sierra 10.12.3 as host OS.
Above lists out the repository where image exists (if not pushed then local), a tag which works like a version, the unique image id. Instead of re-inventing the wheel you should first check if someone already created an image you need and published on docker hub. If not exactly what you want but may be a starting point that you can extend further. To mention docker hub is like a marketplace where you can look for images built by other devs like you. You can simply pull these images if there exists one that does your job. Likewise, once you extend or customize and existing image, then you can push your flavor for other's use. To push or pull you would need to create a docker hub account.
Let's check what images do we have now:
You will notice a new image (2nd last) which we just created. Next step is to run it. And we run an image by initiating a docker container. Let's do that
So, the last word bash here along with option i and t makes the container interactive with bash open. Lets try to run some simple commands.
Though both options will work but 2nd option helps you avoid installing manually every time you have a new container. And this becomes super productive when you need a complete development environment for multiple developers to build and test their work. For example, you can configure with some additional utilities and a node or have a docker container for hosting a db.
Assuming you are convinced with the requirement of having your own image, lets extend our image and rebuild. The modified Dockerfile will look like below:
In simplest form, I would say it is much like a virtulbox or vm but very light weight. Reason? It eliminates an entire OS layer and uses most of the required components from the host OS. I would let you read more firm definition from official docker documentation
I started playing with it very recently and thought to put up some very basic getting started steps. I am using a mac pro with Sierra 10.12.3 as host OS.
Installation
- Head over to https://docs.docker.com/engine/getstarted/step_one/#/docker-for-mac and just hit "Get Docker for Mac".
- Install like any other OSX app and you are done.
- As a confirmation you should see a whale icon in your mac toolbar.
Create Your First Image
Before you create your first docker image, lets check what we already have.
images
This list out all the docker images you already have. e.g.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VSKUMAR-mac:ora-xe-db-docker vskumar$ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
vikceo/oralinux7jdev12c latest 252eed36fbe6 29 minutes ago 4.54 GB | |
oracle/database 12.1.0.2-ee 6a15fdc654e2 2 hours ago 11.2 GB | |
oraxe latest 6d2a0bc19186 3 hours ago 1.15 G | |
Boraclelinux latest 5a42e075a32b 3 weeks ago 225 MB |
For this post, we are extending a Oracle Enterprise Linux 7 image with some of the handy utilities/scripts. To do that, you need to pull the base image as the first step and then start downloading and installing the required utils/scripts. This sequence of steps need to be defined in a file called Dockerfile. To store your docker file and any additional resources, lets start with a new dir.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
VSKUMAR-mac:docker vskumar$ mkdir olex7utils VSKUMAR-mac:docker vskumar$ cd olex7utils/ VSKUMAR-mac:olex7utils vskumar$ pwd /Users/vskumar/docker/olex7utils
Create a text file and name it Dockerfile using your favorite editor. I use sublime. The very first instruction would be to pull the base image (Oracle Enterprise Linux 7 in this case). The file will look like:
Save it and lets build our first image. In this case, we are literally pulling and building an image as is.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM oraclelinux:latest |
build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VSKUMAR-mac:olex7utils vskumar$ docker build -t olex7enhanced . | |
Sending build context to Docker daemon 2.048 kB | |
Step 1/1 : FROM oraclelinux:latest | |
---> 5a42e075a32b | |
Successfully built 5a42e075a32b |
The -t option is to give a tag to the image you just built. The first line sends the data to docker demon. 2nd line prints the step from Dockerfile it executed. 3rd line is a layer identifier (every step is executed as a layer and cached for reuse when you rebuild). Final line shows the image built with its image id.
Let's check what images do we have now:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VSKUMAR-mac:olex7utils vskumar$ docker images | |
REPOSITORY TAG IMAGE ID CREATED SIZE | |
vikceo/oralinux7jdev12c latest 252eed36fbe6 55 minutes ago 4.54 GB | |
oracle/database 12.1.0.2-ee 6a15fdc654e2 3 hours ago 11.2 GB | |
oraxe latest 6d2a0bc19186 3 hours ago 1.15 GB | |
olex7enhanced latest 5a42e075a32b 3 weeks ago 225 MB | |
oraclelinux latest 5a42e075a32b 3 weeks ago 225 MB |
You will notice a new image (2nd last) which we just created. Next step is to run it. And we run an image by initiating a docker container. Let's do that
run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
VSKUMAR-mac:olex7utils vskumar$ docker run -it olex7enhanced bash [root@28e56bb64d39 /]#
If you notice ls worked just fine as it's a base linux image. However, unzip did not. The reason? Well Oracle Linux 7 docker image that you pulled doesn't include that. Options? You have 2 options. First, you go ahead install in the container. Secondly, you can extend this original image and have instructions to install unzip and build an image.This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
[root@28e56bb64d39 /]# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var [root@28e56bb64d39 /]# unzip bash: unzip: command not found [root@28e56bb64d39 /]#
Though both options will work but 2nd option helps you avoid installing manually every time you have a new container. And this becomes super productive when you need a complete development environment for multiple developers to build and test their work. For example, you can configure with some additional utilities and a node or have a docker container for hosting a db.
Assuming you are convinced with the requirement of having your own image, lets extend our image and rebuild. The modified Dockerfile will look like below:
And on building, and starting a new container and trying the same will look like below:This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
FROM oraclelinux:latest RUN yum -y install zip unzip
So, this time you have an enhanced image with unzip installed. Before we go ahead and push it to docker hub lets see how to see all the running containers and stop any if we want.This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
VSKUMAR-mac:olex7utils vskumar$ docker build -t olex7enhanced . Sending build context to Docker daemon 2.048 kB Step 1/2 : FROM oraclelinux:latest ---> 5a42e075a32b Step 2/2 : RUN yum -y install zip unzip ---> Running in 8f9ca828c326Loaded plugins: ovl, ulninfo Resolving Dependencies --> Running transaction check ---> Package unzip.x86_64 0:6.0-16.el7 will be installed ---> Package zip.x86_64 0:3.0-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: unzip x86_64 6.0-16.el7 ol7_latest 169 k zip x86_64 3.0-11.el7 ol7_latest 259 k Transaction Summary ================================================================================ Install 2 Packages Total download size: 428 k Installed size: 1.1 M Downloading packages: -------------------------------------------------------------------------------- Total 2.0 MB/s | 428 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : unzip-6.0-16.el7.x86_64 1/2 Installing : zip-3.0-11.el7.x86_64 2/2 Verifying : zip-3.0-11.el7.x86_64 1/2 Verifying : unzip-6.0-16.el7.x86_64 2/2 Installed: unzip.x86_64 0:6.0-16.el7 zip.x86_64 0:3.0-11.el7 Complete! ---> 7b544317a564 Removing intermediate container 8f9ca828c326 Successfully built 7b544317a564 VSKUMAR-mac:olex7utils vskumar$ docker run -it olex7enhanced bash [root@2ccaa3b792a3 /]# unzip UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send bug reports using http://www.info-zip.org/zip-bug.html; see README for details. Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir] Default action is to extract files in list, except those in xlist, to exdir; file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage). -p extract files to pipe, no messages -l list files (short format) -f freshen existing files, create none -t test compressed archive data -u update files, create if necessary -z display archive comment only -v list verbosely/show version info -T timestamp archive to latest -x exclude files that follow (in xlist) -d extract files into exdir modifiers: -n never overwrite existing files -q quiet mode (-qq => quieter) -o overwrite files WITHOUT prompting -a auto-convert any text files -j junk paths (do not make directories) -aa treat ALL files as text -U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields -C match filenames case-insensitively -L make (some) names lowercase -X restore UID/GID info -V retain VMS version numbers -K keep setuid/setgid/tacky permissions -M pipe through "more" pager -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives -I CHARSET specify a character encoding for UNIX and other archives See "unzip -hh" or unzip.txt for more help. Examples: unzip data1 -x joe => extract all files except joe from zipfile data1.zip unzip -p foo | more => send contents of foo.zip via pipe into program more unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer [root@2ccaa3b792a3 /]#
stop
So, that how we list and stop a container by its id. Lets now push the image to docker hub. For pushing there are 3 steps. 1 tag your image 2 login 3 pushThis file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
VSKUMAR-mac:olex7utils vskumar$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2ccaa3b792a3 olex7enhanced "bash" 3 minutes ago Exited (0) 20 seconds ago quizzical_goldwasser 28e56bb64d39 5a42e075a32b "bash" 18 minutes ago Exited (127) 7 minutes ago distracted_joliot VSKUMAR-mac:olex7utils vskumar$ docker stop 2ccaa3b792a32ccaa3b792a3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
VSKUMAR-mac:olex7utils vskumar$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE olex7enhanced latest 7b544317a564 7 minutes ago 731 MB vikceo/oralinux7jdev12c latest 252eed36fbe6 About an hour ago 4.54 GB oracle/database 12.1.0.2-ee 6a15fdc654e2 3 hours ago 11.2 GB oraxe latest 6d2a0bc19186 4 hours ago 1.15 GB oraclelinux latest 5a42e075a32b 3 weeks ago 225 MB VSKUMAR-mac:olex7utils vskumar$ docker tag 7b544317a564 vikceo/oracle7enhanced:latest VSKUMAR-mac:olex7utils vskumar$ docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username (vikceo): Password: Login Succeeded VSKUMAR-mac:olex7utils vskumar$ docker push vikceo/oracle7enhanced The push refers to a repository [docker.io/vikceo/oracle7enhanced]ce9e66603272: Pushed d423508a08c8: Mounted from vikceo/oralinux7jdev12c latest: digest: sha256:e6535678cce5da5a45f2e33a5189b7f32ac834d3359c96d6f3e3f12013eca7d6 size: 742 VSKUMAR-mac:olex7utils vskumar$
That's it. Your new image is ready for you and World (if you like) to consume. To see how it appears on docker hub here is a screenshot:
Congratulations!!! Hope you find it useful.
Thursday, October 29, 2015
Oracle ADF Jdeveloper 12c Groovy Expression to Generate Sequence no longer works
Until Jdeveloper 12c for supplying primary key to your entity creation you could simply add a groovy expression in the primary key attribute's default expression like:
(new oracle.jbo.server.SequenceImpl("", adf.object.getDBTransaction())).getSequenceNumber()
However, running the same code in Jdeveloper 12 will throw following runtime exception:
General error during semantic analysis: JBO-25152: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.
Solution:
(new oracle.jbo.server.SequenceImpl("
General error during semantic analysis: JBO-25152: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.
Solution:
- Open EO in the source view.
- Search for trustMode="untrusted"
- Change it to trustMode="trusted"
This should work now.
Tuesday, October 27, 2015
Installing Oracle XE on Virtual Box and Accessing it on Mac OS X Yosemite
Oracle XE is not yet supported on Mac OS X and if you are planning to do any development and required a local DB then you are pretty much out of luck to install it.
Solution? Install Virtual Box with linux or windows machine and run oracle XE on it. Access it locally from your host os Yosemite in this case. There are two major steps in this.
Solution? Install Virtual Box with linux or windows machine and run oracle XE on it. Access it locally from your host os Yosemite in this case. There are two major steps in this.
- Installing Virtual box, guest OS and Oracle XE
- Configuring it to access Oracle XE from the Mac Yosemite.
Step 1
- Download latest version of virtual box.
- For the guest OS and DB either you can individual download the images and install all that or you can use one of the Oracle prebuilt images. They will be a bit larger in size due to some more stuff but will do the job as one step solution. I used Downloads and Instructions
- Once you have a everything installed and the image imported you will need to make sure that you can run your XE DB in the guest OS first. Do the following:
- from the Applications menu click on "Oracle XE DB --> Start Oracle Database". Wait for few min.
- From the same place click on "Run SQL lite terminal"
- In the terminal type connect / sysdba and this should connect if DB is up and running.
- by default HR schema is installed and locked. So run the following
- alter user hr account unlocked identified by hr
- This should do the job and will ensure that it all works fine.
Step 2
- Click on the top right corner and enable network on your guest OS (eth0 by default)
- Go to Virtual box and installed image settings. Click Network tab and click on Port Forwarding.
- Add a new entry here marking as: Host ip: 127.0.0.1 port 1522 guest ip: blank port: 1521 and do ok.
- This should now connect to the XE running in guest OS as hr/hr@localhost:1522:XE (service name)
NOTE: The pre-built image I used in step 1 has the port 1521 unblocked by default. If you are manually doing the step 1 then you would need to unblock the 1521 port by guest OS firewall. You can do that following: http://www.thatjeffsmith.com/archive/2014/03/connecting-to-oracle-from-your-host-to-a-virtualbox-oel-guest/
Subscribe to:
Posts (Atom)