A presentation at Docker Birthday #6 in March 2019 in Aix-en-Provence, France by William Bartlett
William Bartlett Email: w.bartlett@treeptik.fr Twitter: @bartlettstarman LinkedIn: punkstarman GitHub: punkstarman
28th March 2019
Don’t install Just run docker run
docker run
William Bartlett, Treeptik
“Use the right tool for the job”
I work on many projects using various technologies and versions of them.
How do you work with varying tech stacks without going mad?
Use containers!
$ sudo apt install mysql $ docker run mysql $ docker-compose up -d
Really?
$ docker run ... maven
All source code at https://gitlab.com/namrats/talks/just-run-it
Requirements
UID=$(id -u) GID=$(id -g) MAVEN_VERSION="3.6.0-jdk-8-alpine" MAVEN_OPTS="-Duser.home=/var/maven" exec docker run -it --rm -u $UID:$GID \ -v $HOME/.m2:/var/maven/.m2 \ -v $PWD:/usr/src/$(basename $PWD) \ -w /usr/src/$(basename $PWD) \ -e HOME=/var/maven \ -e MAVEN_CONFIG=/var/maven/.m2 \ maven:$MAVEN_VERSION mvn $MAVEN_OPTS "$@"
Concerns
Difficulties
stack.yaml
resolver: lts-13.14 docker: enable: true
DOCKERFLAGS=-it --rm -u $(UID):$(GID) \ -v $(LUATEX_CACHE):$(LUATEX_CACHE) \ -v $(CURDIR)/fonts:/usr/local/share/fonts \ -v $(CURDIR):/data \ -w /data \ -e HOME=/tmp TEX_SCRIPT=for run in $$(seq 2) ; \ do $(TEX) $(TEXFLAGS) $< ; \ done $(PROJECT_NAME).pdf: main.tex *.tex $(LUATEX_CACHE) docker run $(DOCKERFLAGS) $(DOCKERIMAGE) \ sh -c '$(TEX_SCRIPT)'
Future work