avatar

Andres Jaimes

Installing Rancher on Ubuntu/Docker

By Andres Jaimes

- 2 minutes read - 243 words

On this article we are going to install a rancher server on Ubuntu. Let’s start by getting the rancher image from docker hub:

sudo docker run -d --restart=always -p 8080:8080 --name=rancher-server rancher/server

Go to http://ip-address:8080 and click on Add Host. It is important that you do not use a localhost address (127.0.0.1, localhost). If you do so, and you want to add your local computer as an agent, you will not be able to reach it.

Add First Host

Verify This site’s address is selected and click Save

Rancher Host Registration

Follow the instructions presented on the next screen in order to install the rancher service.

Load balancer

On the Rancher website, go to the corresponding stack and select the Add Load Balancer option.

Fill in the required fields as displayed in the following image:

Load Balancer

Click on save. After a couple minutes the load balancer will begin dispatching requests on the given addresses/ports.

Rancher on https

You can setup a secure nginx connection by following the instructions on this site:

https://docs.rancher.com/rancher/v1.2/zh/installing-rancher/installing-server/basic-ssl-config/

Troubleshooting

Check container logs:

docker logs -f <container_id>

Check that you can connect to the rancher service (from inside the container):

curl http://127.0.0.1:8080/v1

Check rancher required ports (500 and 4500) are open:

sudo ufw allow proto tcp from <ip-address> to any port 22

References