A Dockerfile for Oracle and perl

I didn’f find a dockerfile for oracle and perl. So I did one by myself.

Quick Instructions: Create dir; Create Dockerfile (above); create oracle_test.pl (above), download the oracle files.

Build it:

docker build -t perl-oracle .

Run it:

docker run -it --rm perl-oracle

I took http://www.ecliptik.com/Containerizing-a-Perl-Script/ as the base and added the information from here: http://www.aboutmonitoring.com/install-dbd-oracle-perl-modules-in-linux/ . To get the 3 Oracle files, you need an Oracle Account and download manualy and put it in your directory.

Your directory should look like this is:

$ ls

with the Dockerfile:

FROM ubuntu:14.04
MAINTAINER Micheal Waltz <ecliptik@gmail.com>
# see http://www.ecliptik.com/Containerizing-a-Perl-Script/

# Dockerfile by Johannes Eiseler 6/2017
# How to build:
# docker build -t perl-oracle .

# How to run:
# docker run -it --rm perl-oracle
# docker run -v /c/Users/myuser/directory/you/like/to/share:/host/directory -it --rm perl-oracle


RUN [ "apt-get", "-q", "update" ]
RUN [ "apt-get", "-qy", "--force-yes", "upgrade" ]
RUN [ "apt-get", "-qy", "--force-yes", "dist-upgrade" ]
RUN [ "apt-get", "install", "-qy", "--force-yes", \
      "perl", \
      "build-essential", \
      "cpanminus" ]
RUN [ "apt-get", "clean" ]
RUN [ "rm", "-rf", "/var/lib/apt/lists/*", "/tmp/*", "/var/tmp/*" ]

#RUN ["cpanm", "Proc::ProcessTable", "Data::Dumper" ]

COPY [ "./oracle_test.pl", "/app/oracle_test.pl" ]
RUN [ "chmod", "+x",  "/app/oracle_test.pl" ]

# now Oracle
# see http://www.aboutmonitoring.com/install-dbd-oracle-perl-modules-in-linux/

COPY [ "./*.rpm", "/app/" ]

RUN ["apt-get", "update"]
RUN ["apt-get", "install", "libaio-dev", "libaio1" ]
RUN ["apt-get", "install", "-qy", "--force-yes", "alien" ]

RUN alien --scripts /app/oracle-instantclient12.2-basic-
RUN alien --scripts /app/oracle-instantclient12.2-devel-
RUN alien --scripts /app/oracle-instantclient12.2-sqlplus-

RUN dpkg -i /app/oracle-instantclient12.2-basic_12.
RUN dpkg -i /app/oracle-instantclient12.2-devel_12.
RUN dpkg -i /app/oracle-instantclient12.2-sqlplus_12.

ENV PATH $PATH:$HOME/bin:/usr/lib/oracle/12.2/client64/bin
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/lib/oracle/12.2/client64/lib
ENV ORACLE_HOME /usr/lib/oracle/12.2/client64/lib

# now perl oracle
RUN ["apt-get", "install", "-qy", "--force-yes", "libdbi-perl" ]
RUN ["cpan", "DBD::Oracle"]

# if you wan't to use it interactivly comment the next line
ENTRYPOINT [ "/app/oracle_test.pl" ]

And the perl script oracle_test.pl:


use strict;
use DBI;

#Take Env Variable
my $workdir = $ENV{'MYWORKINGDIR'};  #Takes the variables

print "Hello World\n";


my $db = DBI->connect("dbi:Oracle:host=your.database.host;sid=yoursid;port=yourport","youruser/yourpassword", "") || die( $DBI::errstr . "\n" );

$db->{AutoCommit}    = 0;
$db->{RaiseError}    = 1;
$db->{ora_check_sql} = 0;
$db->{RowCacheSize}  = 16;

my $SEL = "SELECT * FROM dual";
my $sth = $db->prepare($SEL);
while ( my @row = $sth->fetchrow_array() ) {
    foreach (@row) {
        $_ = "\t" if !defined($_);
        print "$_\t";
    print "\n";
    $db->disconnect if defined($db);

print "----- End of perl file ------\n"

Keywords: Dockerfile, Oracle, Perl, Running perl script connect to oracle

How to use Docker for sqlplus on an Oracle Database

You need a docker installation and a user/password at store.docker.com.

If you got this you can establish a sqlplus session with this docker command:

docker run -ti --rm store/oracle/database-instantclient: sqlplus "user/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=your.host.site)(Port=yourport))(CONNECT_DATA=(SID=yoursid)))"

Keywords: docker, oracle, sqlplus, easy

Aluminum Bike Phone Holder – short Test

I recently bought Banggood: GUB G-86 CNC Aluminum Alloy Bicycle Bike Phone Holder Handbar…. (Or see below for Amazon). I had 3 rides since I mounted it on my cross bike, and my opinion till now is, that it is the best phone holder, which I ever had. Had a few problems by mounting it on my handle bar, but fixed that after 3 tries (see photo). I own a iPhone 6, having placed it in a case. The claws (don’t forget to use adhesive patches) hold it perfect, and it takes really just a part of the time to fix it than with the other holders before. – I recommend it