go-oci8: problem building docker + go-oci8

Hi, I’m trying to build a container and I can’t advance more than a step, I think that I have everything but my docker insists on failing. In my computer I have the following files:

my_project/oracle/instantclient (instant_client version 18.1)
my_project/oracle/oci8.pc

EDIT: I’m using windows 10.

I have the following Dockerfile and oci8.pc files.

prefix=/opt/instantclient
libdir=${prefix}
includedir=${prefix}/sdk/include/

Name: OCI
Description: oci8 library
Libs: -L${libdir} -lclntsh
Cflags: -I${includedir}
Version: 18.1
FROM golang:1.12.7

RUN apt-get update
RUN apt-get install -y pkg-config && \
    apt-get install -y libaio1 

ENV CLIENT_FILENAME instantclient
COPY /oracle/${CLIENT_FILENAME} /opt/instantclient
COPY /oracle/oci8.pc /usr/lib/pkgconfig/oci8.pc

ENV LD_LIBRARY_PATH /usr/lib:/usr/local/lib:/opt/instantclient

RUN go get -u github.com/mattn/go-oci8

The error is:

Step 8/8 : RUN go get -u github.com/mattn/go-oci8
 ---> Running in 0c0a61c9d52e
# github.com/mattn/go-oci8
/usr/bin/ld: cannot find -lclntsh
collect2: error: ld returned 1 exit status
The command '/bin/sh -c go get -u github.com/mattn/go-oci8' returned a non-zero code: 2

I don’t know why I have problems with this line if I create my Dockerfile from https://github.com/jeanmorais/docker-go-oci8 and jeanmorais doesn’t import another library.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

@fabulias you could reduce disk footprint by removing some of the Instant Client libraries. Take a look at some of the Dockerfiles in https://static.rainfocus.com/oracle/oow19/sess/1553560683840001mfXq/PF/DEV4626-Developing-and-Deploying-Python-and-Node.js-Applications-in-Docker_1568845042122001Vsfl.pdf

Glad to hear it is working for you 😃

Please feel free to close the issue.