Installing Oracle Client Tools - Docker, Roundhouse, Oracle - oracle

I am trying to get Roundhouse running from a Docker image where I have some Oracle scripts, but currently when I execute the rh command against my Docker image I get the following error:
A type could not be created from the object you passed. "roundhouse.databases.oracle.OracleDatabase, roundhouse.databases.oracle" resolves to null.
I think this a result of not having the Oracle Client tools configured correctly in my Docker Image(https://github.com/chucknorris/roundhouse/wiki/Oracle).
I have downloaded the rpm files from https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html and I have managed to get the Oracle Client Tools installed but I carry on getting the above error so I assume that this is because I haven't configured the client tools correctly?
Can anyone advise what I am doing wrong?
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
ENV PATH="$PATH:/root/.dotnet/tools"
ADD *.* /
RUN apt-get update && \
apt-get install sudo
#RUN apk --update add libaio bc net-tools
RUN sudo apt-get install unzip
RUN sudo apt-get install wget
RUN sudo apt-get install alien -y
RUN sudo alien -i oracle-instantclient*-basic-*.rpm
RUN sudo alien -i oracle-instantclient*-devel-*.rpm
RUN sudo alien -i oracle-instantclient*-sqlplus-*.rpm
RUN echo /usr/lib/oracle/19.1/client/lib > /etc/ld.so.conf.d/oracle.conf
RUN sudo ldconfig
RUN dotnet tool install --global dotnet-roundhouse --version 1.2.1
ENTRYPOINT [ "rh"]

I had the same error when I tried to use the MS repo.
This worked for me:
Install the oficial oracle instant client container as
oracle/instantclient:19. Instruction here.
On top of that image build this Dockerfile
from oracle/instantclient:19
RUN microdnf install git RUN git clone https://github.com/chucknorris/roundhouse.git
RUN microdnf install dotnet-sdk-2.1
RUN cd roundhouse && dotnet tool install --global dotnet-roundhouse --version 1.2.1
ENTRYPOINT [ "rh"]

Related

Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory"

I am trying to establish a connection from Azure pipelines to oracle using cx_oracle.
I'm using a Dockerfile:
FROM python:3.9-slim-buster
RUN apt-get update && apt-get install -y git && apt-get install telnet
RUN apt-get install -y gcc
RUN apt-get -y install wget
RUN apt -y install unzip
RUN wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip
RUN unzip instantclient-basic-linux.x64-21.5.0.0.0dbru.zip
RUN apt-get -y install libaio1
RUN sh -c "echo /instantclient_21_5 > /etc/ld.so.conf.d/oracle-instantclient.conf"
RUN ldconfig
RUN apt -y remove unzip
RUN rm instantclient-basic-linux.x64-21.5.0.0.0dbru.zip
CMD ["/bin/sh"]
Im doing automated tests using robotframework, i just updated to cx-Oracle 8.3.0. I still get the error
DatabaseError: DPI-1047:
Cannot locate a 64-bit Oracle Client library:
"libclntsh.so: cannot open shared object file:
No such file or directory".

VMSS Custom script not fully executing

We are currently experimenting with new VMSS build agents for our devops environment, which requires some components for each build pipeline.
So to make sure don't need to add this to every build pipeline, we created a startup script which is executed every time the machine is created (standard custom script extension) with the following contents
#install kubectl
echo "Installing KubeCTL"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
echo "Installing DotNet SDK"
#install dotnet runtime (5) for dotnet tool install
sudo apt-get install -y dotnet-sdk-5.0
echo "Installing DotNet DotNet Runtime"
#install dotnet runtime (5) for FluentMigrator
sudo apt-get install -y dotnet-runtime-5.0
echo "Installing DotNet AzureCLI"
#install AzureCLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
echo "Installing Powershell"
#install powershell
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
# Install PowerShell
sudo apt-get install -y powershell
echo "Installing FluentMigrator"
#install fluent migrator
dotnet tool install -g FluentMigrator.DotNet.Cli
echo "Installing OpenJDK"
#install openJDK
sudo apt-get install -y openjdk-11-jre
Now, everything in this script executes and installs without any issues, the build pipeline runs correctly after a new agent is booted up.
However, during release time, we require fluentmigrator, which is not installed even though it is included in the script.
If we add the same install line dotnet tool install -g FluentMigrator.DotNet.Cli as a build step or as a step during release it gets installed correctly. To do this we run a custom bash with the command.
However, i would very much prefer to have this run within the boot-up of the machine instead of adding a custom bash script to 20 release pipelines. Anyone has any idea why the tool is not installing correctly within this script?

mix release on Amazon Linux 2

Goal: to be able to run a phoenix, mix release in an ec2 instance (this machine: https://hub.docker.com/_/amazonlinux/)
Problem: Running my release produces the following error:
/my_app/erts-11.0.3/bin/beam.smp: /lib64/libtinfo.so.6: no version information available (required by /my_app/erts-11.0.3/bin/beam.smp)
2020-09-08 13:17:33.469328
args: [load_failed,"Failed to load NIF library /my_app/lib/crypto-4.7/priv/lib/crypto: 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'","OpenSSL might not format: label: be installed on this system.\n"]
"Unable to load crypto library. Failed with error:~n\"~p, ~s\"~n~s"
{error_logger,error_msg}
but I have openssl installed in each scenario (OpenSSL 1.0.2k-fips 26 Jan 2017).
Setup:
I create a new phoenix project with:
yes | mix phx.new my_app --no-webpack --no-ecto --no-dashboard --no-gettext
cd my_app
and uncomment the config :my_app, MyAppWeb.Endpoint, server: true line in config/prod.secret.exs to start the server when running the app.
I create the following Dockerfile to build my project:
FROM debian:buster
# Install essential build packages
RUN apt-get update
RUN apt-get install -y wget git locales curl gnupg-agent
# Set locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV HOME=/opt/app
WORKDIR /opt/app
# Install erlang and elixir
RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
RUN dpkg -i erlang-solutions_2.0_all.deb
RUN apt-get update
RUN apt-get install -y esl-erlang
RUN apt-get install -y elixir
# Install hex and rebar
RUN mix do local.hex --force, local.rebar --force
# Install phoenix
RUN mix archive.install hex phx_new 1.5.4 --force
COPY mix.exs mix.lock ./
COPY config config
COPY priv priv
COPY lib lib
RUN mix deps.get
ENV SECRET_KEY_BASE='secretExampleQrzdplBPdbHHhr2bpELjiGVGVqmjvFl2JEXdkyla8l6+b2CCcvs'
ENV MIX_ENV=prod
RUN mix phx.digest
RUN mix compile
RUN mix release
CMD ["_build/prod/rel/my_app/bin/my_app", "start"]
and build the image with:
docker build . -t my_app
We can check that everything is running as expected with:
docker run -p 4000:4000 -i my_app:latest
and visiting localhost:4000.
I copy the _build/prod/rel/my_app directory from the built docker container (as this is all I'll be transferring across to my ec2 instance).
# list all containers
docker container ls -a
# locate the container with image tag: my_app:latest. It should look like:
# f9c46df97e55 my_app:latest "_build/prod/rel/my_…"
# note the container_id, and copy across the build release
docker cp f9c46df97e55:/opt/app/_build/prod/rel/my_app .
We create an instance.Dockerfile to run the commands of our ec2 instance:
FROM amazonlinux:latest
COPY my_app my_app
CMD ["my_app/bin/my_app", "start"]
and run it:
docker build . -f instance.Dockerfile -t my_app_instance && docker run -p 4000:4000 -i my_app_instance:latest
This fails to run, with the error:
[load_failed,"Failed to 2020-09-08 13:27:49.980715
args: load NIF library /my_app/lib/crypto-4.7/priv/lib/crypt format: label: 2020-09-08 13:27:49.981847 supervisor_report o: 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'","OpenSSL might not be installed on this system.\n"]
"Unable to load crypto library. Failed with error:~n\"~p, ~s\"~n~s"
{error_logger,error_msg}
Note:
I am able to replicate the error on a debian:buster machine with the above docker build ... && docker run ... command, but with this instance.Dockerfile:
FROM debian:buster
RUN apt-get update
RUN apt-get install -y locales
# Set locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
COPY my_app my_app
CMD ["my_app/bin/my_app", "start"]
and fix the error by changing: RUN apt-get install -y locales to RUN apt-get install -y locales curl.
I have tried yum install curl and yum install openssl on the amazonlinux:latest machine, but still experience the same error.
Question:
Where should I look to make progress on this? It seems to be an erlang/otp requirement issue, but the above is hardly a sscce, so difficult to raise.
I have struggled with finding what crypto or openssl library the apt-get curl package installs which causes the error to be fixed.
Any pointers to a particular forum to ask for help, or what to try next would be greatly appreciated.
Thanks in advance for the help.
Thanks to the suggestion to build it on CentOs from #VenkatakumarSrinivasan,
I managed to get it working on an amazonlinux machine with the following Dockerfiles.
Building the release:
FROM centos:7
RUN yum update -y
RUN yum clean -y all
RUN echo 'LC_ALL="en_US.UTF-8"' >> /etc/locale.conf
ENV LC_ALL="en_US.UTF-8"
RUN yum install -y epel-release
RUN yum install -y gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel \
autoconf java-1.8.0-openjdk-devel git wget wxBase.x86_64
WORKDIR /opt
RUN wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
RUN rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
RUN yum update -y
RUN yum install -y erlang
WORKDIR /opt/elixir
RUN git clone https://github.com/elixir-lang/elixir.git /opt/elixir
RUN make clean test
ENV PATH=/opt/elixir/bin:${PATH}
RUN mix do local.hex --force, local.rebar --force
RUN mix archive.install hex phx_new 1.5.4 --force
WORKDIR /opt/app
COPY mix.exs mix.lock ./
COPY config config
COPY priv priv
COPY lib lib
RUN mix deps.get
ENV SECRET_KEY_BASE='secretExampleQrzdplBPdbHHhr2bpELjiGVGVqmjvFl2JEXdkyla8l6+b2CCcvs'
ENV MIX_ENV=prod
RUN mix phx.digest
RUN mix compile
RUN mix release
CMD ["_build/prod/rel/my_app/bin/my_app", "start"]
Running the release:
FROM amazonlinux:latest
RUN yum -y update
ENV LANG="en_US.UTF-8"
ENV LC_ALL="en_US.UTF-8"
RUN ln -s /usr/lib64/libtinfo.so.{6,5}
COPY my_app my_app
CMD ["my_app/bin/my_app", "start"]
I'm not sure if this is a satisfying solution though, I'm open to a more elegant solution.

Dockerfile for windows container-Java-maven-chrome

I am new to docker and I have installed docker for windows server 2016 and it is working fine. However, I am struggling to write a Dockerfile for windows. Can someone translate the below dockerfile to be able to run in windows?? I am trying to build an image that has java8, maven and chrome and chrome driver installed. However, windows based docker daemon has issues with apt-get, wget etc etc
Dockerfile
FROM openjdk
#Install Maven
RUN apt-get update && \apt-get install -y maven && \apt-get clean
# Install Chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
# install chromedriver
#RUN apt-get install -yqq unzip
RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
copy ..

`docker build` fails trying to install ubuntu packages

Trying to build a simple ubuntu apache web server docker image, I get an error while the docker build command tries installing packages. I am using the Ubuntu base image in Docker to do this. Below is the code in my Dockerfile;
FROM ubuntu
RUN apt-get update
RUN apt-get install apache2
RUN apt-get install apache2-utils
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
My Host OS is Mac OSX El Capitan, and the error I get when the build fails is;
The command '/bin/sh -c apt-get install apache2' returned a non-zero code: 1
and my docker build command is;
docker build -t="webserver" .
Any help please. Thanks in Advance.
You should use the '-y' apt-get flag when building an image.
apt-get will ask you permission to continue with apache installation, and since you can't interact with the apt-get while building the image, you must pass the '-y' flag that means 'yes' to apt-get prompt.
Try changing it to:
FROM ubuntu
RUN apt-get update
RUN apt-get install apache2 -y
RUN apt-get install apache2-utils -y
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
or even:
FROM ubuntu
RUN apt-get update && apt-get install apache2 apache2-utils -y
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]

Resources