pkg_config_path error on building with docker

人走茶凉 提交于 2021-01-01 07:50:31

问题


When I am building an image for my Go application through docker, I am getting the following error:

# pkg-config --cflags oci8

Package oci8 was not found in the pkg-config search path. Perhaps you should add the directory containing `oci8.pc' to the PKG_CONFIG_PATH environment variable No package 'oci8' found pkg-config: exit status 1

I have set the environment variable in my Dockerfile also. But still the issue persists. My Dockerfile is:

*FROM golang:1.9
ARG app_env
ENV APP_ENV $app_env
ENV GOPATH /home/nupur/mapi-go
ENV PKG_CONFIG_PATH /home/nupur/mapi-go
ENV ORACLE_HOME /usr/include/oracle/11.2/client64
ENV LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
WORKDIR /home/nupur/mapi-go/src/DockerApp/blDocker
ADD . .
RUN go build /home/nupur/mapi-go/src/DockerApp/blDocker/launch.go
ENTRYPOINT ["./launch"]
EXPOSE 8093*

Please suggest a solution.


回答1:


I am not sure had you solved this problem cause this problem has been asked two years ago ... From your Dockerfile, you already set the PKG_CONFIG_PATH, but after setting WORKDIR you used ADD command, so you add files to your WORKDIR that does not include your PKG_CONFIG_PATH. I think you should use ls for your PKG_CONFIG_PATH to see if any file called oci8.pc exited. In this case I suggest to use COPY command to move oci.pc to PKG_CONFIG_PATH specially.



来源:https://stackoverflow.com/questions/47407093/pkg-config-path-error-on-building-with-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!