Programster's Blog

Tutorials focusing on Linux, programming, and open source

Deploy Rancher On Ubuntu 16.04

Rancher is a powerful web-based management tool for managing docker containers across any number of docker hosts.



The best part is that it is simple to deploy through docker as I will show you below.

Visit the Rancher website or their Vimeo page for more info about Rancher.

Requirements

  • Rancher requires at least 1 GB of RAM, but the hosts you have it manage can be 512MB. I would urge you to give the rancher host more than this or set up a swapfile if possible.

Steps

Install docker on your server if you haven't already.

Run the commands below to deploy the rancher server container. This will create a folder called rancher-data in your $HOME directory where all data for Rancher will be stored. This way, your data isn't lost if your container dies, and you can also re-deploy on another server if you just move that folder to the new server.

HOST_VOLUME=$HOME/rancher-data/mysql
mkdir -p $HOST_VOLUME

sudo docker run -d \
-v $HOST_VOLUME:/var/lib/mysql \
--restart=unless-stopped \
-p 8080:8080 \
rancher/server

Now wait a few minutes for the image to be pulled down and for the container to set up. Eventually, you will be able to go to your server's IP or hostname on port 8080 in your browser, such as

rancher.programster.org:8080

...and see the following screen:

Conclusion

You now have a simple Rancher server deployed. I now suggest you move onto configuring local access control.

References