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-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 ,可自行修改

添加guacamole应用

# 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连接

在这里插入图片描述

创建连接,图中所填参数均为必填,其他选填

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

是不是很简单!
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值