Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: Clone git repo in current directory

Tags:

git

docker

I am using docker to clone a public repository. It's cloned successfully. But I don't know where its cloned? Also how can I clone the repo in my current working directory using docker?

Dockerfile

FROM debian:stretch

RUN apt-get update
RUN apt-get install -y git
RUN git clone https://github.com/ishpreet-singh/Sudoku.git

Terminal

root@ubuntu:/home/hp1/Desktop/src/sample# docker build -t img2 .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM debian:stretch
 ---> 6d83de432e98
Step 2/4 : RUN apt-get update
 ---> Using cache
 ---> 5ad3bd342683
Step 3/4 : RUN apt-get install -y git
 ---> Using cache
 ---> 29bdeb15539f
Step 4/4 : RUN git clone https://github.com/ishpreet-singh/Sudoku.git
 ---> Running in 613bdd58bc99
Cloning into 'Sudoku'...
 ---> ba9f61f10baf
Removing intermediate container 613bdd58bc99
Successfully built ba9f61f10baf
Successfully tagged img2:latest
like image 281
Ishpreet Avatar asked Nov 15 '25 19:11

Ishpreet


1 Answers

The repository will be cloned to the WORKDIR directory which defaults to /.

So after logging into container you'll find the cloned repository under /Sudoku.

Cloning a git repo using docker seems to be a strange scenario? Why would one do that?

like image 96
Opal Avatar answered Nov 18 '25 12:11

Opal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!