Rancher - andreydiveev/wiki GitHub Wiki

Install (setup swap; Debian 9.x required):

docker run \
    --restart=unless-stopped \
    --name=rancher-server \
    -l rap.host=admin.foo.com \
    -l rap.port=8080 \
    -l rap.le_host=admin.foo.com \
    -l [email protected] \
    -l io.rancher.container.pull_image=always \
    -v /opt/rancher-mysql:/var/lib/mysql \
    -d -p 8080:8080 rancher/server

Internal:

docker run \
    --restart=unless-stopped \
    --name=rancher-server \
    -l io.rancher.container.pull_image=always \
    -v /opt/rancher-mysql:/var/lib/mysql \
    -d -p 10.42.0.1:8080:8080 rancher/server

Install rancher-compose:

wget -O - https://github.com/rancher/rancher-compose/releases/download/v0.12.5/rancher-compose-linux-amd64-v0.12.5.tar.gz 

Add host:

apt update
apt install curl
curl https://releases.rancher.com/install-docker/18.09.sh | sh

Env vars (at .bashrc):

export RANCHER_ACCESS_KEY=""
export RANCHER_SECRET_KEY=""
export RANCHER_URL=""

One-line web-server:

version: '2'
services:
  php-fpm:
    image: php:7.1
    command:
    - php
    - -S
    - 0.0.0.0:8091
    - /etc/issue

Rancher Active Proxy:

Options of rancher-compose ...:

-p, --project-name : Specify an alternate project name (default: directory name)
-f, --file         : Specify an alternate compose file (default: docker-compose.yml) [$COMPOSE_FILE]
-e, --env-file     : Specify a file from which to read environment variables
--url              : Specify the Rancher API endpoint URL [$RANCHER_URL]
--access-key       : Specify Rancher API access key [$RANCHER_ACCESS_KEY]
--secret-key       : Specify Rancher API secret key [$RANCHER_SECRET_KEY]

Options of rancher-compose up ...:

-u, --upgrade, --recreate : Upgrade if service has changed
-c, --confirm-upgrade     : Confirm that the upgrade was success and delete old containers
-d                        : Do not block and log
-p, --pull                : Before doing the upgrade do an image pull on all hosts that have the image already