docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

Oracle Instaclient on Mac M1

Open pthomasjoby opened this issue 3 years ago • 2 comments

I am trying to move the existing nodejs application development environment from Intel based Mac to an M1 based Mac. But the docker-compose failed with the following message:

Following is an excerpt from the log:

=> => sha256:fb4b26362d76fe9c76ad0791479ea7abb738eeee61380fdbdb4328d289c5ba3c 11.53MB / 17.73MB                                                                             2.4s
=> ERROR [oracle 2/2] RUN set -ex;     curl -o /etc/yum.repos.d/public-yum-ol7.repo https://yum.oracle.com/public-yum-ol7.repo;     yum-config-manager --enable ol7_oracle  2.4s
------
> [oracle 2/2] RUN set -ex;     curl -o /etc/yum.repos.d/public-yum-ol7.repo https://yum.oracle.com/public-yum-ol7.repo;     yum-config-manager --enable ol7_oracle_instantclient;     yum -y install oracle-instantclient18.3-basic;:
#7 0.164 + curl -o /etc/yum.repos.d/public-yum-ol7.repo https://yum.oracle.com/public-yum-ol7.repo
#7 0.167   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#7 0.167                                  Dload  Upload   Total   Spent    Left  Speed
....
....
#7 2.273 https://yum.oracle.com/repo/OracleLinux/OL7/UEKR5/aarch64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
#7 2.273 Trying other mirror.
#7 2.274
#7 2.274
#7 2.274  One of the configured repositories failed (Latest Unbreakable Enterprise Kernel Release 5 for Oracle Linux 7Server (aarch64)),
#7 2.274  and yum doesn't have enough cached data to continue. At this point the only
#7 2.274  safe thing yum can do is fail. There are a few ways to work "fix" this:
#7 2.274
#7 2.274      1. Contact the upstream for the repository and get them to fix the problem.
#7 2.274
#7 2.274      2. Reconfigure the baseurl/etc. for the repository, to point to a working
#7 2.274         upstream. This is most often useful if you are using a newer
#7 2.274         distribution release than is supported by the repository (and the
#7 2.274         packages for the previous distribution release still work).
#7 2.274
#7 2.274      3. Run the command with the repository temporarily disabled
#7 2.274             yum --disablerepo=ol7_UEKR5 ...
#7 2.274
#7 2.274      4. Disable the repository permanently, so yum won't use it by default. Yum
#7 2.274         will then just ignore the repository until you permanently enable it
#7 2.274         again or use --enablerepo for temporary usage:
#7 2.274
#7 2.274             yum-config-manager --disable ol7_UEKR5
#7 2.274         or
#7 2.274             subscription-manager repos --disable=ol7_UEKR5
#7 2.274
#7 2.274      5. Configure the failing repository to be skipped, if it is unavailable.
#7 2.274         Note that yum will try to contact the repo. when it runs most commands,
#7 2.274         so will have to try and fail each time (and thus. yum will be be much
#7 2.274         slower). If it is a very temporary problem though, this is often a nice
#7 2.274         compromise:
#7 2.274
#7 2.274             yum-config-manager --save --setopt=ol7_UEKR5.skip_if_unavailable=true
#7 2.274
#7 2.274 failure: repodata/repomd.xml from ol7_UEKR5: [Errno 256] No more mirrors to try.
#7 2.274 https://yum.oracle.com/repo/OracleLinux/OL7/UEKR5/aarch64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
------
executor failed running [/bin/sh -c set -ex;     curl -o /etc/yum.repos.d/public-yum-ol7.repo https://yum.oracle.com/public-yum-ol7.repo;     yum-config-manager --enable ol7_oracle_instantclient;     yum -y install oracle-instantclient18.3-basic;]: exit code: 1
ERROR: Service 'server' failed to build : Build failed

Following is another excerpt from the Dockerfile:

# Build oracle instaclient18.3 from upstream
FROM oraclelinux:7-slim as oracle

RUN set -ex; \
    curl -o /etc/yum.repos.d/public-yum-ol7.repo https://yum.oracle.com/public-yum-ol7.repo; \
    yum-config-manager --enable ol7_oracle_instantclient; \
    yum -y install oracle-instantclient18.3-basic;

# Run server from node
FROM node:8.15

# Copy oracle client libraries and install libaio1 dependency
COPY --from=oracle /usr/lib/oracle/ /usr/lib/oracle/
RUN set -ex; \
    ln -s /usr/lib/oracle/18.3/client64/lib/libclntsh.so.18.1 /usr/lib/oracle/18.3/client64/lib/libclntsh.so; \
    echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle-instantclient18.3.conf; \
    ldconfig; \
    apt-get update; \
    apt-get install -y --no-install-recommends libaio1; \
    rm -rf /var/lib/apt/lists/*;

@yunus-qureshi

pthomasjoby avatar Aug 31 '22 21:08 pthomasjoby

We don't release the Instant Client on Arm for Oracle Linux 7. You'd need to switch to Oracle Linux 8 and use Oracle Instant Client 19. This Dockerfile should build for aarch64: https://github.com/oracle/docker-images/blob/main/OracleInstantClient/oraclelinux8/19/Dockerfile

I'll test it now myself and comment back if it doesn't work.

Djelibeybi avatar Aug 31 '22 21:08 Djelibeybi

Needs a slight tweak as it appears we've only released v19.10 for Arm:

FROM oraclelinux:8

ARG release=19
ARG update=10

RUN  dnf -y install oracle-release-el8 && \
     dnf -y install oracle-instantclient${release}.${update}-basic \
         oracle-instantclient${release}.${update}-devel \
         oracle-instantclient${release}.${update}-sqlplus \
     && rm -rf /var/cache/dnf

CMD ["sqlplus", "-v"]

Djelibeybi avatar Aug 31 '22 21:08 Djelibeybi

Just adding my two cents worth....I had the same issue, running instantclient on M1 using arm architecture. What I did was create a Dockerfile which added the instantclient to the container, I also had the rails app copied into /app. Finally I built the Dockerfile that created the app, and when I ran the app I connected to the container to get a bash shell, now my project was loaded as /app in the docker container. I could edit the files locally on the M1 and use Sourcetree to modify the modified changes. So in essence the rails app was executing in the linux container, using my local drive. I ran the container with -e "TZ=Pacific/Auckland" -v /Volumes/projects/galown:/app --add-host=kubernetes.docker.internal:host-gateway bash and then started up puma with bundle exec puma -C config/puma.rb A workaround but way better than mixing intel and arm gems

grantlees avatar Oct 03 '22 00:10 grantlees

@grantlees thanks for sharing.

cjbj avatar Oct 03 '22 02:10 cjbj