What's your way of running 'git clone' with RancherOS?

I’d like to give ROS a try, but I’m facing some “philosophical” issues due to its very peculiar arch.

I have an online git repository with code, Dockerfile and docker-compose.yml to pop up a multy tier docker infrastructure.

I need to run “git clone” at first, to get a persistent directory with all the code in my repo, from where running “docker-compose up” to start the all infrastructure.

How can I do that ? What is RancherOS way here ?

@lgs

I make it to run a git container as local command, so you needn’t deal with the package manager, such as apt-get, yum or apk, etc. It’s only 22MB and build on alpine linux.

usage

alias git="docker run -ti --rm -v $(pwd):/git bwits/docker-git-alpine"

For example, if you need clone this repository, with the alias you just set, you can run it as local command

git --help
git clone https://github.com/BWITS/docker-git-alpine.git
ls docker-git-alpine

Only recommend to clone the git repository with https url to avoid ssh key setup

4 Likes

For those coming from Google, RancherOS does not have a /home/rancher/.profile file for you to add aliases, so you will need to create it first.

sudo vi /home/rancheros/.profile then paste and :wq.