… with Git, Tmux, Oh My Zsh, Mosh (and Docker).
This article aims at learning how to install lovely command-line tools in a recoverable way.
You’ll be able to multiplex zsh terminals over a UDP connexion (using mobile shell):
The reader is strongly encouraged to browse thoroughly the Dockerfile put in reference,
which steps summarize how to build the premises of such a text-only environment.
Disclaimer: To some extent, you might feel a bit dizzy because of the specially crafted mise en abyme.
The dizziness is a typical side effect of linux container abuse…
No worries, the feeling will just vanish with time (or you might just end up killing the wrong processes).
Each and every user of linux distributions (or similarly flavoured operating systems)
might take a minute or two to acknowledge the significance of their own
Even though they are hidden by design, I believe our productivity directly depends on the care they receive from us.
We all have heard (if not even worse) of hard drives just dying in some random boxes.
Still feeling a bit sceptical? Pretty numbers
have been published on
Backblaze blog just to satisfy our curiosity.
Being a big fan of upcycling doesn’t strictly imply there could be some happy ending for few choosen hard drives, anyway.
The bottom line is, the more precious and rapidly changing our data feel
and the more regular we shall have backup for them ready to be restored.
I insist on the latter part as knowing precisely
how to restore backups is the only way to really feel confident about them.
Let us see how to proceed in order to get things done i.e. hidden
dot files safe.
The experiment is bootstrapped with the now classic installation of vagrant and virtual box.
For instance, in a box running Wheezy 7.3, we would execute the commands:
# Add a GPG key downloaded from virtual box official website wget -q http://
download.virtualbox.org/ virtualbox/ debian/ oracle_vbox.asc -O- | sudo apt-key add - # Download package lists from repositories sudo apt-get update # Install virtualbox sudo apt-get install virtualbox-4.
Binaries for other operating systems can be fetched from the official VirtualBox download page.
The Vagrant download page offers 64-bit installation package for Debian:
# Install dependencies to share folders with NFS sudo apt-get install nfs-kernel-server nfs-command # Download Vagrant installation package wget https://
dl.bintray.com/ mitchellh/ vagrant/ vagrant_1.4.3_x86_64.deb -O /tmp/vagrant_1.4.3_x86_64.deb # Install Vagrant sudo dpkg -i /tmp/vagrant_1.4.3_x86_64.deb
# Clone the linux container engine repository (we assume Git has already been installed in the host) git clone https://
github.com/ dotcloud/ docker.git && cd docker # Run Vagrant vagrant up # Access the vagrant box provided by DotCloud to use docker from their official box vagrant ssh
# Install git, vim and mobile shell in the vagrant box sudo apt-get install git vim mosh # Clone the repository containing a Dockerfile git clone https://
github.com/ thierrymarianne/ zen-cmd.git zen-cmd # Run the Dockerfile from the newly cloned repository and tag it as "zen-cmd" cd zen-cmd && docker build . -t zen-cmd
From this point, one shall have received a positive message (
Successfully built) well accompanied by a pretty hash.
These 12 characters are to be kept preciously.
Believe it or not, we are done already here or better said,
our personal shell has been set up according to our container building script (Dockerfile).
The pretty hash identifies a docker image which can now be run in order to use our command-line interface.
In a nutshell,
Dockerfileabout what needs to be customized.
Fellows of little faith are absolutely right in showing doubts about this so let us run the interactive shell
(within a container within a vagrant box), in order to proceed, one just needs to execute the following commands
# Copy predefined SSH configuration from the article repository cp -R ./ssh/* /home/vagrant/.ssh # Start an ssh agent ssh-agent /bin/bash # Let our ssh agent handling a key allowed to access the container # with passphrase being "elvish_word_for_friend" # (One shall certainly generate its own pair of keys # using `ssh-keygen -f path_to_private_key` otherwise) chmod 0400 ~/.ssh/zen-cmd && ssh-add ~/.ssh/zen-cmd # Run openssh daemon from our brand new container identified by a tag docker run -d -t zen-cmd /usr/sbin/sshd -D & export LC_ALL=en_US.UTF-8 && /usr/bin/mosh-server new -p 6000 # Alias container ip address to "zen-cmd" host sudo /bin/bash -c "echo `docker inspect zen-cmd | grep IPAddress | cut -d '\"' -f 4`' zen-cmd' >> /etc/hosts" # Access our portable command-line environment using mosh-client mosh zen-cmd # In the container, run tmux to multiplex zsh terminals tmux
Let us dive into the details of this automated script :
Since we mostly deal with plain text files here,
git appears to be a quite legitimate version control system.
Even GitHub made a point in popularizing the habit of sharing them (the
What are the direct benefits coming out of it?
According to their unofficial guide,
I hope you have enjoyed this setup which has the clear advantages of being portable, testable and recoverable.
Syntax to write your own
Dockerfile can be found in Docker official documentation.
This article was originally published on Theodo blog on the 30th of January 2014.