关注微信公众号
第一手干货与资讯
加入官方微信群
获取免费技术支持
Hi, I’m Sidhartha Mani, one of the engineers at Rancher, and I wanted to provide a quick overview for how to get started using RancherOS. RancherOS is a micro-linux distribution that has the aim of providing just the right amount of OS to run Docker. It turns out, all Docker really requires to function is the kernel. RancherOS embraces this by running Docker as PID1 and everything running inside of it is a container. At about 22MB, the OS is easy to distribute, orchestrate and spin up in your data center. You can learn more about RancherOS on our website.
In this blog, I will walk through spinning up RancherOS on virtualbox using Docker machine. This is the easiest way to get RancherOS up and running.
.iso
rancheros.iso
machine-rancheros.iso
Go to your console, and use this command
docker-machine create -d virtualbox --virtualbox-boot2docker-url $RANCHEROS-ISO-URL $MACHINE-NAME
Note that, For the v0.3.3 release of RancherOS, the value for RANCHEROS-ISO-URL is https://github.com/rancher/os/releases/download/v0.3.3/machine-rancheros.iso MACHINE-NAME is the name that you would like to call your machine.
RANCHEROS-ISO-URL
https://github.com/rancher/os/releases/download/v0.3.3/machine-rancheros.iso
MACHINE-NAME
That’s it. You have a RancherOS host running on virtualbox now. You can verify that you have a VirtualBox VM running on your host using this command VBoxManage list runningvms | grep $MACHINE-NAME It should print out the newly crated machine. If not, something went wrong with the provisioning step.
VBoxManage list runningvms | grep $MACHINE-NAME
Logging into RancherOS follows the standard docker-machine way. Use this command to login into your newly provisioned RancherOS VM. docker-machine ssh $MACHINE-NAME This will log you into the RancherOS VM. You’ll then be able to explore the OS, run commands, spin up containers etc. Once you’ve finished exploring, exit by pressing Ctrl+D
docker-machine ssh $MACHINE-NAME
Ctrl+D
You can point the docker client on your host to the docker daemon running inside of the VM. That way, you can run your docker commands like you had installed docker on your host. To point your docker client to the daemon inside the VM, use this command eval $(docker-machine env $MACHINE-NAME) You can run any docker commmand like you would normally, and it will execute your command in the RancherOS VM.
eval $(docker-machine env $MACHINE-NAME)
docker run -p 80:80 -p 443:443 -d nginx This will startup nginx on your VM. In order to access it, you need the ip address of the VM. docker-machine ip $MACHINE-NAME If you copy the IP address printed from the above command and paste it in your browser, you should see a Welcome Page for nginx!
docker run -p 80:80 -p 443:443 -d nginx
docker-machine ip $MACHINE-NAME
The above information should help you get started with RancherOS.
If you’re interested in learning more about RancherOS, or our management and infrastructure platform Rancher, please join us for one of our upcoming online meetups. Sidhartha Mani is an engineer at Rancher Labs, you can follow him on Twitterand Github.