Skip to content

Instantly share code, notes, and snippets.

@liyuntao
Created July 1, 2017 17:45
Show Gist options
  • Save liyuntao/1b0a0f604cac7ad2ddb541199bb7f1d0 to your computer and use it in GitHub Desktop.
Save liyuntao/1b0a0f604cac7ad2ddb541199bb7f1d0 to your computer and use it in GitHub Desktop.
rancher with external mysql(docker-compose)
version: '2'
services:
rancher-server:
image: 'rancher/server:stable'
container_name: rancher-server
restart: always
volumes_from:
- rancher-db
ports:
- "8080:8080"
depends_on:
- rancher-db
environment:
- CATTLE_DB_CATTLE_MYSQL_HOST=rancher-db
- CATTLE_DB_CATTLE_MYSQL_PORT=3306
- CATTLE_DB_CATTLE_MYSQL_NAME=rancher
- CATTLE_DB_CATTLE_USERNAME=rancher
- CATTLE_DB_CATTLE_PASSWORD=yourdbpassword
rancher-db:
image: mysql
container_name: rancher-db
restart: always
volumes_from:
- rancher-db-data
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=yourrootpasswd
- MYSQL_DATABASE=rancher
- MYSQL_USER=rancher
- MYSQL_PASSWORD=yourdbpassword
command: "--character-set-server=utf8 --collation-server=utf8_general_ci"
rancher-db-data:
container_name : rancher-db-data
image: gliderlabs/alpine
restart: always
volumes:
- ./rancher_data:/var/lib/mysql
command: /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment