我正在尝试创建一个Docker镜像,它从私有和公共GitHub存储库中提取。我使用的Dockerfile是:
FROM golang:1.4.2-onbuild
ENV GOPATH /go
ENV PATH /go/bin:$PATH
EXPOSE 3000
RUN mkdir -p /go/src/github.com/eddi/api
RUN git clone https://<access token>@github.com/owner/repo.git /go/src/github.com/owner/repo
WORKDIR /go/src/github.com/eddi/api
RUN go get github.com/gin-gonic/gin
RUN go run server.go
但是当我运行docker build .时,我会收到以下错误:
对于私有和公共存储库都是如此。我该如何使我的dockerfile在导入库时表现良好?cd .; git clone https://github.com/gin-gonic/gin /go/src/github.com/gin-gonic/gin
正在克隆至 '/go/src/github.com/gin-gonic/gin'...
致命错误:无法访问 'https://github.com/gin-gonic/gin/':无法解析主机名:github.com