Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过HTTPS的Git克隆在Docker makefile中不起作用_Git_Github_Docker_Dockerfile - Fatal编程技术网

通过HTTPS的Git克隆在Docker makefile中不起作用

通过HTTPS的Git克隆在Docker makefile中不起作用,git,github,docker,dockerfile,Git,Github,Docker,Dockerfile,我是Docker新手,希望git在Dockerfile中通过HTTPS从GitHub克隆公共存储库。到目前为止,我已经成功地安装了一些软件包,但我一直在克隆存储库 我的Dockerfile如下所示: FROM pasmod/miniconder2 RUN apt-get update && \ apt-get install -y build-essential libxml2-dev libxslt-dev python-matplotlib libsm6 libxr

我是Docker新手,希望git在Dockerfile中通过HTTPS从GitHub克隆公共存储库。到目前为止,我已经成功地安装了一些软件包,但我一直在克隆存储库

我的Dockerfile如下所示:

FROM pasmod/miniconder2

RUN apt-get update && \
    apt-get install -y build-essential libxml2-dev libxslt-dev python-matplotlib libsm6 libxrender1 libfontconfig1 libicu-dev python-dev  && \
    apt-get clean

WORKDIR /var/www
ADD . .
RUN git clone --verbose https://github.com/ikekonglp/TweeboParser.git
不幸的是,git克隆启动了,但没有成功

输出:

Step 5 : RUN git clone --verbose https://github.com/ikekonglp/TweeboParser.git
 ---> Running in ecd389a3edb6
Cloning into 'TweeboParser'...
POST git-upload-pack (202 bytes)
 ---> 5c01489b08c8
Removing intermediate container ecd389a3edb6
Successfully built 5c01489b08c8
Dockerfile执行时没有错误,但GitHub存储库没有克隆。如果我在容器中执行git克隆,它将成功克隆存储库


我怎样才能解决这个问题

您的代码没有问题。它确实克隆了存储库,正如您在显示目录内容时所看到的那样。只需将这两行附加到Dockerfile:

RUN ls -al /var/www
RUN ls -al /var/www/TweeboParser
第一行应产生以下输出:

Step 6 : RUN ls -al /var/www
 ---> Running in 3fa524f85311
total 16
drwxr-xr-x  3 root root 4096 May 11 10:19 .
drwxr-xr-x 12 root root 4096 May 11 10:11 ..
-rw-r--r--  1 root root  359 May 11 10:19 Dockerfile
drwxr-xr-x  8 root root 4096 May 11 10:19 TweeboParser
第二行显示了目录解析器的内容:

Step 7 : RUN ls -al /var/www/TweeboParser
 ---> Running in 4240f956f5d5
total 88
drwxr-xr-x 8 root root  4096 May 11 10:19 .
drwxr-xr-x 3 root root  4096 May 11 10:19 ..
drwxr-xr-x 8 root root  4096 May 11 10:19 .git
-rw-r--r-- 1 root root 35141 May 11 10:19 COPYING
-rw-r--r-- 1 root root  6416 May 11 10:19 README.md
drwxr-xr-x 8 root root  4096 May 11 10:19 TBParser
drwxr-xr-x 4 root root  4096 May 11 10:19 Tweebank
drwxr-xr-x 6 root root  4096 May 11 10:19 ark-tweet-nlp-0.3.2
-rwxr-xr-x 1 root root  1314 May 11 10:19 install.sh
-rwxr-xr-x 1 root root  3153 May 11 10:19 run.sh
-rw-r--r-- 1 root root   263 May 11 10:19 sample_input.txt
drwxr-xr-x 2 root root  4096 May 11 10:19 scripts
drwxr-xr-x 2 root root  4096 May 11 10:19 token_selection

谢谢我将卷映射到同一目录,该目录覆盖了克隆的存储库:/