citronas
citronas

Reputation: 19365

Git clone via HTTPS not working in Docker makefile

I'm new to Docker and want to git clone a public repository via HTTPS from GitHub in the Dockerfile. So far I've managed to install a few packages but I'm stuck at cloning a repository.

My Dockerfile looks like this:

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

Unfortunately, the git clone starts but does not succeed.

Output:

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

The Dockerfile is executed without error but the GitHub repository is not cloned. If I execute the git clone inside the container it clones the repository successfully.

How can I fix this?

Upvotes: 1

Views: 1148

Answers (1)

n2o
n2o

Reputation: 6487

There's nothing wrong with your code. And it does clone the repository as you can see when you show the content of your directory. Just append these two lines to your Dockerfile:

RUN ls -al /var/www
RUN ls -al /var/www/TweeboParser

The first line should produce this output:

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

And the second line shows the content of the directory 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

Upvotes: 2

Related Questions