使用docker构建时出现pkg_config_path错误 [英] pkg_config_path error on building with docker

查看:167
本文介绍了使用docker构建时出现pkg_config_path错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过docker为Go应用程序构建映像时,出现以下错误:

#pkg-config --cflags oci8

在pkg-config搜索路径中找不到包oci8.也许您应该添加包含"oci8.pc"的目录到PKG_CONFIG_PATH环境变量找不到软件包"oci8"pkg-config:退出状态1

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

我也在Dockerfile中设置了环境变量.但是问题仍然存在.我的Dockerfile是:

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*

请提出解决方案.

推荐答案

我不确定您是否已解决此问题,因为此问题已在两年前被问到...在Dockerfile中,您已经设置了 PKG_CONFIG_PATH ,但是在设置WORKDIR之后,您使用了 ADD 命令,因此您将不包含 PKG_CONFIG_PATH <的文件添加到了WORKDIR中./code>.我认为您应该对 PKG_CONFIG_PATH 使用 ls 来查看是否存在任何名为oci8.pc的文件.在这种情况下,我建议使用 COPY 命令将oci.pc专门移至 PKG_CONFIG_PATH .

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.

这篇关于使用docker构建时出现pkg_config_path错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆