docker + Rancher + guacamole 容器环境搭建并配置vnc连接
Rancher + guacamole 容器环境搭建准备环境:docker ce(17.01+) + centos7.x + guacamole(最新版0.9.14) +Rancher搭建完成效果:1.安装docker ce 环境# yum list installed | grep docker# yum install -y yum-utils device-m...
·
Rancher + guacamole 容器环境搭建
准备环境:docker ce(17.01+) + centos7.x + guacamole(最新版0.9.14) +Rancher
搭建完成效果:
1.安装docker ce 环境
# yum list installed | grep docker
# yum install -y yum-utils device-mapper-persistent-data lvm2
# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# yum makecache fast
# yum -y install docker-ce
注意Rancher需要docker ce 17.03+版本以上
2.安装rancher
rancher版本我选用1.6版, 2.0版本bug有点多。先把防火墙关闭了,不关闭得开放一些端口,这些端口可以在rancher官网找到
# systemctl start docker
# docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
等容器启动后访问 http://<你的ip>:8080/ 然后设置你的管理账户密码,添加主机等等操作
3.添加guacamole 应用
核心两个文件docker-compose.yml + rancher-compose.yml 我用的是apache 官方最新的guacamole 镜像。rancher社区维护的是9.10的。用户密码均为 guacadmin ,可自行修改
# docker-compose.yml 内容如下
version: '2'
services:
database:
image: mariadb
environment:
MYSQL_DATABASE: guacamole_db
MYSQL_ONETIME_PASSWORD: 'true'
MYSQL_PASSWORD: z:^<OAA^/(Ioa/AN
MYSQL_RANDOM_ROOT_PASSWORD: 'true'
MYSQL_USER: guacamole_user
volumes_from:
- database-data
labels:
io.rancher.sidekicks: setup-get-db-script,database-data
guacamole:
image: guacamole/guacamole
environment:
MYSQL_DATABASE: guacamole_db
MYSQL_HOSTNAME: database
MYSQL_PASSWORD: z:^<OAA^/(Ioa/AN
MYSQL_USER: guacamole_user
links:
- guacd:guacd
ports:
- 8082:8080/tcp
command:
- /bin/bash
- -c
- cd /usr/local/tomcat/webapps;rm -rf ROOT/; ln -s guacamole.war ROOT.war; /opt/guacamole/bin/start.sh;
guacd:
image: guacamole/guacd
setup-get-db-script:
image: guacamole/guacamole
network_mode: none
volumes_from:
- database-data
command:
- bash
- -c
- /opt/guacamole/bin/initdb.sh --mysql > /docker-entrypoint-initdb.d/initdb.sql
labels:
io.rancher.container.start_once: 'true'
database-data:
image: busybox
entrypoint:
- /bin/true
network_mode: none
volumes:
- /docker-entrypoint-initdb.d
- /var/lib/mysql
labels:
io.rancher.container.start_once: 'true'
# rancher-compose.yml 内容如下
version: '2'
services:
database:
scale: 1
start_on_create: true
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 3306
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
strategy: recreate
reinitializing_timeout: 60000
guacamole:
scale: 1
start_on_create: true
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 8080
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
strategy: recreate
request_line: GET "/guacamole" "HTTP/1.0"
reinitializing_timeout: 60000
guacd:
scale: 1
start_on_create: true
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 4822
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
strategy: recreate
reinitializing_timeout: 60000
setup-get-db-script:
scale: 1
start_on_create: true
database-data:
scale: 1
start_on_create: true
用户名密码均为guacadmin登录后进行一个vnc连接配置,配置vnc咱总得在一个服务器上装vnc服务吧,太简单了,有了docker找个镜像就可以
1. docker run -d consol/ubuntu-xfce-vnc
下图就是一个带有vnc服务的容器
回到guacamole配置vnc连接
创建连接,图中所填参数均为必填,其他选填
是不是很简单!
更多推荐
已为社区贡献2条内容
所有评论(0)