-
Notifications
You must be signed in to change notification settings - Fork 1
Create and Destroy Stack and Services Using Rancher CLI
-
Clone rancher-workshop git repository on your dev machine
-
Open a terminal from where you can run Rancher CLI commands
-
Create stack named "my-stack" in a given environment, and then start it (will use default values for catalog item)
./rancher --url http://192.168.99.100:8080 --access-key 9E27BDAEBC51FF4249D9 --secret-key QWpmxggKe8toiCA123g2xddtAhhYnBH93s1mupqC stacks create my-stack --docker-compose <RANCHER_WORKSHOP_HOME>/templates /alpine/0/docker-compose.yml --rancher-compose <RANCHER_WORKSHOP_HOME>/templates/alpine/0/rancher-compose.yml --start # 1st15
Rancher CLI does not support (yet) variable interpolation for the environment variable values found in docker-compose file (see this GitHub issue).
If you need to set these variables to other values than the default ones found in rancher-compose file, you need to use Rancher Compose tool.
But THIS does work:
rancher --url http://192.168.99.100:8080 --access-key AACAD6D5CCAFF51961E7 --secret-key qsmfKLQqKPYBTR9E8zEXynQ9uxfed2QwebbyyZoJ up -d -s my-stack -e answers.txt <<< EOF
You need to use "<<< EOF" to avoid the interaction with the tools and ensure the variable interpolation will use the given answers.txt file - see this example.
Additionally, check Rancher CLI up command. -
Stop and then remove stack "my-stack" in a given environment (including its services, containers and volumes)
./rancher --url http://192.168.99.100:8080 --access-key 9E27BDAEBC51FF4249D9 --secret-key QWpmxggKe8toiCA123g2xddtAhhYnBH93s1mupqC rm --type stack --stop my-stack # 1st15