Docker Compose on RancherOS
I lost the better part of an entire workday trying to figure out how to run
docker-compose up on my RancherOS box. I found alot of other people asking the same question but nobody provided a clear cut answer.
What is RancherOS
RancherOS is an awesome container focused distribution provided by the folks over at Rancher Labs. I decided to use RancherOS instead of my goto, which is Ubuntu Server, because RancherOS is tiny and completely focused on doing one thing right. Docker Containers! Since I’m completely new to Docker I figured why not start with something simple and focused.
I have a project on GitHub that I wrote a docker-compose file for. Getting this file was the first hurdle. RancherOS does not include ‘git’. The default console is based off busybox which I’ve never used. I searched the problem and found that I could install a git container and run commands on the local file system using that container, ok, weird but I tried it and it worked. I did the same thing with nano as I’m a vi idiot and that is all that is on RancherOS by default.
I have the files, now what?
With some trial and error I finally got the repository on my server. Whew….that was hard! So I cd to my project directory and run
docker-compose up, and recieve a command not found. With some research I found that RancherOS does not include docker-compose either, and all attempts to try and find out how to install it either point to installing the Rancher Server (which is too much for me, I use Portainer) or doing the weird run docker-compose in a container trick. Maybe this trick isn’t weird to you Docker pros but to me it raises questions!
The solution was so simple, and I can’t stress this enough. READ THE RANCHER DOCUMENTATION! The answer was right there and it starts with understanding what RancherOS really is.
Ever see that movie called Inception? RancherOS is kindof like that. When you SSH to your RancherOS box you are actually in a docker container, the real os is running that container. Crazy!
Why is this important?
Since the console you are running on is a container you can simply Switch Consoles. Mind blown!
You can see the list of available consoles by running the following command, and look there, Ubuntu!!!
To switch to Ubuntu simply run
Once the server reboots you will be in a good old familiar Ubuntu shell. Now, since the consoles have peristent storage you can install git, install nano, install docker-compose…..basicly install anything you want!!!