Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

How to install git on a docker ubuntu image?

$
0
0

I have a simple docker file of

FROM ubuntu:18.04COPY . /usr/src/app/COPY docker_files/.bash_aliases /root/$ docker build -t dock .Sending build context to Docker daemon  146.9kBStep 1/3 : FROM ubuntu:18.04 ---> 94e814e2efa8Step 2/3 : COPY . /usr/src/app/ ---> bf79eb6c42c1Step 3/3 : COPY docker_files/.bash_aliases /root/ ---> aedc97d5ee8bSuccessfully built aedc97d5ee8bSuccessfully tagged dock:latest

I can use it:

$ docker run -it dockbash: git: command not foundroot@6a6bec871690:/# ls usr/src/app/Dockerfile  Gemfile  Gemfile.lock  README.md  docker_files  go  ...root@6a6bec871690:/# 

and as you see my files were copied and aliases created for root. However git was not found (hence the err msg) and not installed.
How do I install it given my attempt below failed?

root@753b573271d5:/# gitbash: git: command not foundroot@753b573271d5:/# apt-get install gitReading package lists... DoneBuilding dependency tree       Reading state information... DoneE: Unable to locate package gitroot@753b573271d5:/# sudo apt-get install git bash: sudo: command not found

Viewing all articles
Browse latest Browse all 5962

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>