Docker Community Forums

Share and learn in the Docker community.

Running Git in a Docker container


(Vic) #1

I created a Docker image that contains the newest version of git. This is my Dockerfile:

FROM ubuntu:14.04
MAINTAINER firstname lastname <email@domain.com>

RUN apt-get install -y software-properties-common
RUN apt-add-repository -y ppa:git-core/ppa
RUN apt-get update

RUN apt-get install -y git man

ENTRYPOINT ["git"]

I’m running git status as

docker run --rm -ti -v `pwd`:`pwd` -w `pwd` username/git:latest status

which works if I run it in the directory that contains the .git directory, but does not work in any of the subdirectories. I get a predictable error message:

fatal: Not a git repository (or any parent up to mount point /Users/me/workspace/dockerfiles/vim) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Is there any way to move past this?