# OpenGaussInDocker **Repository Path**: AiGenApps/open-gauss-in-docker ## Basic Information - **Project Name**: OpenGaussInDocker - **Description**: 专注于将OpenGauss数据库容器化,简化部署流程,提高运行效率,适用于各种云环境和本地测试。 - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-03-10 - **Last Updated**: 2025-03-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenGaussInDocker ## OpenGauss下载地址 [OpenGauss下载](https://opengauss.org/zh/download/) ## Docker镜像使用说明 ### 1. 镜像构建 #### 版本6.0.1 ```bash cd 6.0.1 docker build -t opengauss:6.0.1 . ``` #### 版本6.0.0 > 注意事项: > 1. 请手动下载安装包 [openGauss-Lite-6.0.0-openEuler22.03-x86_64.tar.gz](https://opengauss.org/zh/download/) > 2. 将下载文件放置到6.0.0目录中 ```bash cd 6.0.0 docker build -t opengauss:6.0.0 . ``` ### 2. 运行容器 ```bash docker run -d --name opengauss-server -p 5432:5432 -e GAUSS_SUPERUSER_NAME=myuser -e GAUSS_SUPERUSER_PASSWORD=mypwd opengauss:6.0.1 ``` ### 3. 数据库连接 - 使用gsql客户端: ```bash docker exec -it opengauss-server gsql -d postgres -U myuser ``` - 应用程序连接: ``` 主机:localhost 端口:5432 用户名:myuser 密码:mypwd 数据库:postgres ``` ### 4. 环境变量 **安全注意事项** - 默认凭证(superuser/P@ssw0rd)仅适用于测试环境 - 生产环境必须通过`-e`参数覆盖默认值 - 建议定期轮换数据库密码 | 变量名 | 默认值 | 描述 | | ------------------------ | --------- | -------------- | | GAUSS_SUPERUSER_NAME | superuser | 数据库超级用户 | | GAUSS_SUPERUSER_PASSWORD | P@ssw0rd | 超级用户密码 | ### 5. 验证运行状态 ```bash docker exec opengauss-server pg_isready -d postgres -U myuser # 预期输出:localhost:5432 - accepting connections ```