Skip to content

Instantly share code, notes, and snippets.

@trane
Last active September 1, 2016 18:38
Show Gist options
  • Save trane/7c25ad9dda7d70a6a37136732785cd6f to your computer and use it in GitHub Desktop.
Save trane/7c25ad9dda7d70a6a37136732785cd6f to your computer and use it in GitHub Desktop.

Data container Dockerfile (using debian just because I want git with https support, this could be something much smaller)

FROM debian:jessie

ENV DOMINO_ECR_NAMESPACE /ecr-data

# this would be part of a git-type ECR prep-script
RUN apt-get update &&\
	apt-get install -y git

RUN mkdir -p $DOMINO_ECR_NAMESPACE && cd $DOMINO_ECR_NAMESPACE

# this would be constructed on the server with something like the following for git:
# cmd=git clone
# url=https://..../domino.git
# unique_name=domino
# s"$cmd $url $unique_name"
RUN git clone https://<your personal access token>@github.com/cerebrotech/domino.git $DOMINO_ECR_NAMESPACE/domino

# this would be created on the server, too
VOLUME /ecr-data/domino

Build the image and create the docker data container, naming it based on the run ids

$ docker build -t ecr-git-domino .
$ docker run --name ecr-git-domino-run-1234abcd ecr-git-domino true
$ docker run --name ecr-git-domino-run-5678efgh ecr-git-domino true

Execute a run container, mounting the volumes from the data container

$ docker run --rm --volumes-from ecr-git-domino-run-1234abcd --name domino-run-1234abcd -ti busybox
$ docker run --rm --volumes-from ecr-git-domino-run-5678efgh --name domino-run-5678efgh -ti busybox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment