douchun1961 2019-03-11 17:38
浏览 86
已采纳

是否可以在Docker中安装gopkg.in软件包?

I am trying to run golang application which use goracle library with such Dockerfile:

FROM golang:1.12

RUN go get github.com/gorilla/mux && \
  go get github.com/gorilla/handlers && \
  go get github.com/lib/pq && \
  go get github.com/joho/godotenv && \
  go get github.com/jinzhu/gorm && \
  go get gopkg.in/goracle.v2

ADD ./ /go/src/application

WORKDIR /go/src/application

RUN go build -o /bin application

ENV PORT=8000

CMD ["/bin"]

Unfortunatly it raise error when I try to create image:

package gopkg.in/goracle.v2: unrecognized import path "gopkg.in/goracle.v2" (https fetch: Get https://gopkg.in/goracle.v2?go-get=1: proxyconnect tcp: tls: first record does not look like a TLS handshake)
The command '/bin/sh -c go get github.com/gorilla/mux &&   go get github.com/gorilla/handlers &&   go get github.com/lib/pq &&   go get github.com/joho/godotenv &&   go get github.com/jinzhu/gorm &&   go get gopkg.in/goracle.v2' returned a non-zero code: 1

Why I can't install goracle library in Docker? How to fix this problem?

  • 写回答

1条回答 默认 最新

  • du127953 2019-03-13 17:18
    关注

    In my case the CentOS server where was located Docker has proxy. For thats why I couldn't download the gopkg.in/goracle.v2 package.

    SOLUTION:

    1) Create vender folder inside your project.

    2) Remove source code of gopkg.in/goracle.v2 package which you has in go/src folder to vender folder.

    3) Run you Dockerfile.

    In my case this instruction removed problem with importing of gopkg.in/goracle.v2 package.

    I hope this post will helpful for somebody!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?