I have got Rancher Server to work on a recent installation of Ubuntu 16.04 on my laptop. I am experimenting with Rancher to manage making some new Docker images to use for local development at the moment. I am using the laptop as the host with its external IP address on the LAN as the host IP address.
As this is a laptop, I am wanting to turn it off every evening.
What is the best way to turn off and restart Rancher-Server in my set up?
So far I have tried a few tactics.
- Stopping all the Docker images
I have closed the Rancher GUI and then stopped all the Docker containers for Rancher, both the server one and the ones related to the host, which is my laptop.
On restarting Rancher Server, I have then restarted the nine or so containers related to the laptop as host. I have found they have not all restarted at once. After some further restarting of the containers which have exited soon after I attempted to restart them, I have eventually got the host back up. For the most part this works, but it is quite a tedious process.
Simply closing down the laptop
Once I think I left the Rancher containers running and simply switched the laptop off. When I switched it back on, Rancher Server restarted itself, and to my surprise, this seemed to work quite well, and the host has been picked up too. However I am uncomfortable with doing this.
Removing Host containers and adding the host back
I have also tried stopping and deleting all the host containers, after first stopping the Rancher Server.
A few minutes after restarting Rancher Server, I have added the laptop as a new host (again), running the command line script on the second of the two ‘Add host’ pages. This has added the host back in really quite quickly, and so in some ways I have preferred this method.
The problem with this method for restarting, though, is that any container I have built in Rancher, though it has appeared momentarily, has then been deleted and I have lost it. That’s a shame, because that’s one of the main benefits of using Rancher in my testing ground scenario. The containers I have built from the Docker CLI are fine - they persist and are picked up by the host laptop quite quickly.
So my questions are:
a) What’s the best way for me to stop Rancher-Server and my laptop as host?
b) What’s the best way for me to restart Rancher-Server, without losing containers and stacks I have built using the Rancher interface?