-4

I am trying to find a docker image that includes both docker and git. I know docker images that includes docker (which does not include apt-get to install git on) and some other images that includes git (e.g. alpine/git or bitnami/git) without docker. But I need an image to include both. Would you please help me on this?

I tried following image:

  • docker:latest
  • alpine/git:latest
  • bitnami/git:latest
3
  • 3
    This doesn't seem like it'd be hard to install these using a well-known base layer. Have you tried writing your own dockerfile? Commented Jul 1 at 16:43
  • IME you rarely need either tool in a Docker image. Your container needs to be given significantly elevated privileges to be able to run docker commands at all; trying to RUN git clone ... hits both authentication and layer-caching issues. Do you actually need these tools? Why? As @StephenNewell suggests, have you tried installing them on top of a debian or ubuntu base image? Commented Jul 1 at 17:17
  • What would you need it for? You may be approaching a problem with a suboptimal mindset. Commented Jul 1 at 22:39

1 Answer 1

2

You won't find many official Docker images that include both docker and git out of the box, because they're typically meant to be minimal for security and performance reasons. But you can create your own custom image fairly easily.

FROM docker:latest

# Install Git (requires apk since alpine doesn't have apt-get)
RUN apk add --no-cache git

then you just build it:
docker build -t docker-git .

And there you go.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.