Install Git In Docker

Amresh Yadav
1 min readJan 15, 2020

--

How to install GIT using docker.

In order to install the Git in the docker you first need to install Debian

Run the below command:

> docker run -it debian:jessie

it will run debian image in interactive mode.

After the debian will install and run when you try to run the > git command it will say “git command not found”

Run the below command

> apt-get update && apt-get install -y git

Once this step complete it will install the git in your docker container.

You can save this new container and publish to your docker hub account.

eg.

> docker commit <contaier-id> <docker-hub-profile>/debian

then you can publish this to docker hub

> docker push <docker-hub-profile>/debian

This image will have git installed.

Happy Learning!!!

--

--