#docker #baremetal #linux
Running Docker on a docker-based OS
I have been following RancherOS for quite some time, but somehow never got past just running the example as a VM. However, I have now installed on bare-metal and I have to say that it is a revelation.
To understand the basics, please take time to read the page and watch the video https://rancher.com/rancher-os
The ISO is less than 100MB and there are versions for both Intel and ARM-based platforms and I set mine up on nothing fancy (a HP Compaq 8200 ultra-slim desktop with Core i3 and 8GB RAM). It took around 30 minutes to have running the current CE version of docker, together with a ubuntu console (more of which, later).
So, the idea is to boot off the ISO, install to hard drive and then access remotely via ssh – so I can hide the ancient HP box under my desk.
First, create a config file containing the public part of an ssh-key, something similar to this, taking care to indent the 2nd line
#cloud-config ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6KLZr...PT9I2rVkySlT7UmiFl email@example.com
Note: If you don’t yet have an ssh key-pair, take a look at this document: generate an ssh key-pair
Now, make your cloud-config.yml available via an HTTP server on your local network. A quick way to do this is in python:
python -m SimpleHTTPServer
This runs a simple HTTP server on port 8000, by default.
So, now switch to your target machine and boot from the Rancher OS ISO, available here: https://github.com/rancher/os
While booting, start reading this: https://rancher.com/docs/os/v1.x/en/
You will see that Rancher have provided a very useful tool, called ros
So to install Rancher OS, is as easy as
sudo ros install -c http://[your-server-IP]:8000/cloud-config.yml -d /dev/sda
A word of caution – this didn’t work for me the first couple of times I tried it; the problem was the layout of the .yml file. Rancher must have seen this before, because they provide a yml file validator.
So, pull the .yml file to your local shell with:
sudo ros config validate -i cloud-config.yml
OK, so run the install command as above, answer yes when asked and Rancher OS will be installed to your hard drive.
Congratulations! You now have the bare minimum of OS on which to run your docker containers.
But wait – Rancher OS can be made even more useful by swapping out the default busybox console:
First, find out what consoles are available on your hardware:
$ sudo ros console list disabled alpine disabled centos disabled debian current default disabled fedora disabled ubuntu
Then install your favourite – it’s just a docker container:
sudo ros console switch ubuntu
This action will drop your ssh connection, so log in again and go have some docker-based fun…
This site uses Akismet to reduce spam. Learn how your comment data is processed.