cd ~/life && git log | head
This post a more a less a "I've tested this, this worked and I use it that way" post since I know that some people that follows what I do are interested by this subject.
This is about a better base image (for ubuntu) for Docker that the official one. The official docker ubuntu image has a series of problem:
As promised by base-image, this image indeed solves all those issues and I've just got the impression of having a plain ubuntu server when using it.
I use this docker for 3 things:
Extract from my DockerFile which install salt minion:
FROM phusion/baseimage:0.9.11 # choose your version here (just pick the version number) # https://github.com/phusion/baseimage-docker/blob/master/Changelog.md MAINTAINER Bill Gates "bill.gates@microsoft.com" ENV HOME /root CMD ["/sbin/my_init"] RUN sed 's/main$/main universe/' -i /etc/apt/sources.list RUN sed 's/trusty universe/trusty universe multiverse/' -i /etc/apt/sources.list RUN sed 's/trusty-updates universe/trusty universe multiverse/' -i /etc/apt/sources.lists # install salt RUN add-apt-repository -y ppa:saltstack/salt RUN apt-get update RUN mkdir /srv/salt -p RUN mkdir /srv/pillar -p # my custom renderer for salt because yaml/jinja has way too much overhead to write (https://github.com/Psycojoker/dawdaw) RUN mkdir /srv/salt/_renderers -p RUN curl "https://raw.githubusercontent.com/Psycojoker/dawdaw/master/dawdaw_template.py" > /srv/salt/_renderers/dawdaw_template.py RUN salt-call --local saltutil.sync_renderers RUN apt-get install -y vim python-software-properties salt-minion python-pip git zsh python-dev screen tmux # I want to use zsh RUN sed '1s/bash/zsh/' -i /etc/passwd # change root password RUN sed '1s#:[^:]\+:#:put your password string here:#' -i /etc/shadow # add your stuff here # clean stuff RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
I've also made 2 zsh function because I'm lazy and that I don't like to remember docker commands:
# my docker image is tagged/named 'proto' # usage: # start_proto # or # start_proto $SOME_DOCKER_IMAGE_IDENTIFIANT # same for start_protoi # start the container in daemon mod, you'll need to ssh to it after # (general they have the ip 172.17.0.*, do a nmap -sP 172.17.0.* if you can't find it) # (or a "docker ps" then "docker info $ID_TAKEN_FROM_PS" | grep IPAddress) start_proto() { docker run -t -d $([ "$1" ] && echo $1 || echo proto) /sbin/my_init } # start the container in interactive mode (you'll end up in zsh) start_protoi() { docker run -t -i $([ "$1" ] && echo $1 || echo proto) /sbin/my_init -- zsh -l }
And my zsh completion script (I've just RTFM how to make them, it's super easy, I'm making one for everything now /o):
#compdef start_proto _arguments "1: :($(docker images | awk '{print $1}' | sed '1d' | grep -v "<none>" | sort | uniq))"
And
#compdef start_protoi _arguments "1: :($(docker images | awk '{print $1}' | sed '1d' | grep -v "<none>" | sort | uniq))"
You need to put them in a _start_proto and _start_protoi files somewhere on the path listed by "echo $fpath" (or extend this path: typically 'fpath=(~/.zsh/completion $fpath)' in your ~/.zshrc and make sure to have "autoload -U compinit" and "compinit" in your ~/.zshrc)