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:

  • Start a service in docker container failed,with error: Failed to get D-Bus connection: No connection to service manager
  • What's the fastest way to migrate from boot2docker to Vagrant+NFS on Mac OS X?
  • How to run Rails migrations and seeding in Amazon Elastic Beanstalk single container Docker environment
  • How do I use map[string]struct{}
  • 502 Bad Gateway on Docker, NPM, PHPFPM and Symfony
  • How to access the virtual repo in artifactory
  • 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?

  • How to Create MongoDB cluster as Docker Containers
  • Containers on different hosts are not reachable
  • Docker swarm with nginx as cache: 502 bad gateway
  • Does Kubernetes download Docker image automatically?
  • “Peer's certificate issuer has been marked as not trusted by the user” in Openshift3
  • Installation latest kubernetes version (1.1.1) on Mesos 0.25
  • 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.