8.1 Pakaging Git with a Dockerfile

Name the new file Dockerfile. Write the following five lines and then save the file:

  1. # An example Dockerfile for installing Git on Ubuntu
  2. FROM ubuntu:latest
  3. LABEL maintainer="dia@allingeek.com"
  4. RUN apt-get update && apt-get install -y git
  5. ENTRYPOINT ["git"]

build a new image with the Dockerfile
don’t forget the ‘.’ , represent the current directory

  1. docker image build --tag ubuntu-git:auto .

image.png
image.png
now you can run a Git command using the new image:

  1. docker container run --rm ubuntu-git:auto