Skip to content

Instantly share code, notes, and snippets.

@573
Created March 12, 2018 08:13
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 573/ae3b2f912116d141d74bd32dac5cda81 to your computer and use it in GitHub Desktop.
Save 573/ae3b2f912116d141d74bd32dac5cda81 to your computer and use it in GitHub Desktop.
git clone when using docker-compose.yml

Tried different scenarios, i. e. RUN git clone ... inside the Dockerfile with a host volume mounted inside the container, but neither of them go me the git-cloned files in the volume (host side), seemed lost somewhere inbetween layers, have to investigate the cause.

What did work for now was using command: git clone ... in the services section of the docker-compose.yml file.

version: '3.3'
services:
git:
image: git_sample_app_docker_compose:1.0
container_name: git_sample_app_docker_compose
build: .
command: git -C /build clone https://github.com/leebrandt/docker-compose-example.git
volumes:
- ./build:/build
FROM alpine/git:1.0.4
CMD ["git", "version"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment