Docker安装部署Guacamole

admin2024-04-03  0

拉取镜像

Docker安装部署Guacamole,第1张容器编排

# 创建程序主目录
mkdir -p /opt/guacamole
# 创建插件目录
mkdir -p /opt/guacamole/extensions
# 创建录像目录
mkdir -p /opt/guacamole/recordings
# 创建数据库初始化脚本目录
mkdir -p /opt/guacamole/initdb.d
# 链接插件
guacamole-auth-quickconnect-1.5.4.tar.gz
# 存储插件
guacamole-history-recording-storage-1.5.4.tar.gz
# 解压插件
tar -zxvf guacamole-auth-quickconnect-1.5.4.tar.gz
tar -zxvf guacamole-history-recording-storage-1.5.4.tar.gz
# 移动插件至插件目录
mv guacamole-auth-quickconnect-1.5.4/guacamole-auth-quickconnect-1.5.4.jar /opt/guacamole/extensions/
mv guacamole-history-recording-storage-1.5.4/guacamole-history-recording-storage-1.5.4.jar /opt/guacamole/extensions/
# 配置插件目录所有者 1001为guacamole容器内的guacamole用户UID和GID
chown -R 1001.1001 /opt/guacamole/extensions

# 配置插件目录权限
chmod -R 755 /opt/guacamole/extensions
# 配置录像目录所有者
# 1000为guacd容器内的guacd用户UID
# 1001为guacamole容器内的guacamole用户组GID
chown 1000.1001 /opt/guacamole/recordings
# 配置插件目录权限
chmod 2750 /opt/guacamole/recordings
# 运行guacamole容器生成数据库初始化脚本
docker run --rm guacamole/guacamole:1.5.4 /opt/guacamole/bin/initdb.sh --mysql > /opt/guacamole/initdb.d/initdb.sql

 

容器编排文件

查看docker-compose.yml

services:
  guacamole-mysql:
      image: mysql:8.0.18
      container_name: guacamole-mysql
      volumes:
        - /etc/localtime:/etc/localtime:ro
        # 数据库数据绑定至guacamole-mysql-data卷
        - guacamole-mysql-data:/var/lib/mysql
        # 数据库初始化脚本
        - /opt/guacamole/initdb.d/initdb.sql:/docker-entrypoint-initdb.d/initdb.sql
      command:
        - "--character-set-server=utf8"
        - "--collation-server=utf8_bin"
      restart: always
      environment:
        # 数据库root密码
        - MYSQL_ROOT_PASSWORD=2477bb2991dd472094d118ad9bafa0ce
        # 数据库名
        - MYSQL_DATABASE=guacamole
        # 数据库用户
        - MYSQL_USER=guacamole
        # 数据库密码
        - MYSQL_PASSWORD=fea78183e72c4e7798e1d803e2d36109
      ports:
        - "3306:3306"
      expose:
        - "3306"
      networks:
        guacamole_network:

  guacamole-guacd:
    image: guacamole/guacd:1.5.4
    container_name: guacamole-guacd
    volumes:
      - /etc/localtime:/etc/localtime:ro
      # 录像目录
      - /opt/guacamole/recordings:/var/lib/guacamole/recordings
    restart: always
    ports:
        - "4822:4822"
    expose:
        - "4822"
    networks:
      guacamole_network:

  guacamole-web:
    image: guacamole/guacamole:1.5.4
    container_name: guacamole-web
    volumes:
      - /etc/localtime:/etc/localtime:ro
      # 录像目录
      - /opt/guacamole/recordings:/var/lib/guacamole/recordings
      # 插件目录
      - /opt/guacamole/extensions:/etc/guacamole/extensions
    restart: always
    environment:
      # guacd主机名
      - GUACD_HOSTNAME=guacamole-guacd
      # guacd端口
      - GUACD_PORT=4822
      # 首选认证方式
      - EXTENSION_PRIORITY=mysql
      # 数据库主机名
      - MYSQL_HOSTNAME=guacamole-mysql
      # 数据库端口
      - MYSQL_PORT=3306
      # 数据库名
      - MYSQL_DATABASE=guacamole
      # 数据库用户
      - MYSQL_USER=guacamole
      # 数据库密码
      - MYSQL_PASSWORD=fea78183e72c4e7798e1d803e2d36109
      # guacamole主目录(插件、库、配置等)
      - GUACAMOLE_HOME=/etc/guacamole
      # 会话超时时间 单位: 分钟
      - API_SESSION_TIMEOUT=60
    ports:
      - "80:8080"
    networks:
      guacamole_network:


networks:
  guacamole_network:
    name: "guacamole_network"
    driver: bridge
    ipam:
      config:
        - subnet: 172.31.125.0/24
          gateway: 172.31.125.1


volumes:
  # 数据库数据卷
  guacamole-mysql-data:
    name: "guacamole-mysql-data"

mv docker-compose.yml /opt/guacamole

运行容器

# 进入目录
cd /opt/guacamole
# 启动容器
docker compose up -d

Docker安装部署Guacamole,第2张

使用

浏览器访问:http://IP地址/guacamole
用户名:guacadmin
密码:guacadmin

 Docker安装部署Guacamole,第3张

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明原文出处。如若内容造成侵权/违法违规/事实不符,请联系SD编程学习网:675289112@qq.com进行投诉反馈,一经查实,立即删除!