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:

  • How can I use YAML objects from docker-compose as variables in DockerFile and scripts
  • One docker container per node or many containers per big node
  • How to list all tags for a Docker image on a remote registry?
  • docker-compose down default_network error
  • Node / Express app can't connect to docker mongodb
  • Docker 1.9.0 “bridge” versus a custom bridge network results in difference in hosts file and SSH_CLIENT env variable
  • 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?

  • Getting Unsupported protocol scheme error with docker in pycharm
  • Docker mount error in windows
  • How to delete an inherit property from yaml config?
  • Installing Islandora-claw's docker image
  • docker-py: Accessing output of python script run in ENTRYPOINT command
  • About workaround on bug of runc
  • One Solution collect form web for “Git clone via HTTPS not working in Docker makefile”

    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
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.