云原生之使用Docker部署Gitblit服务器
- 一、Gitblit介绍
- 二、检查本地docker环境
- 1.检查docker版本
- 2.检查docker状态
- 三、下载Gitblit镜像
- 四、部署Gitblit应用
- 1.创建部署目录
- 2.创建Gitblit容器
- 3.检查Gitblit容器状态
- 4.检查Gitblit容器运行日志
- 五、访问Gitblit首页
- 1.访问Gitblit首页
- 2.登录Gitblit
- 3.https访问Gitblit服务器
一、Gitblit介绍
Gitblit 是一个开源的纯 Java Git 解决方案,用于管理、查看和服务Git存储库。它可以通过 GIT、HTTP 和 SSH 传输服务存储库
二、检查本地docker环境
1.检查docker版本
检查本地安装docker版本
[root@jeven ~]# docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:05:12 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:03:33 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
2.检查docker状态
[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2023-03-03 21:15:36 CST; 2 days ago
Docs: https://docs.docker.com
Main PID: 10070 (dockerd)
Tasks: 65
Memory: 208.5M
三、下载Gitblit镜像
从dockerhub下载Gitblit镜像
[root@jeven ~]# docker pull jacekkow/gitblit:v1.9.1
v1.9.1: Pulling from jacekkow/gitblit
57df1a1f1ad8: Pull complete
71e126169501: Pull complete
1af28a55c3f3: Pull complete
a9777c2d5c29: Pull complete
9248106993db: Pull complete
1f74ab5b5b3e: Pull complete
f33944599fe3: Pull complete
3ec5e998e40a: Pull complete
3a0313c9dd93: Pull complete
f2c7438691bf: Pull complete
Digest: sha256:d683b5e04f737315f047baec795d70bb21fa1a0ef8a8956044694f96c6c2f677
Status: Downloaded newer image for jacekkow/gitblit:v1.9.1
docker.io/jacekkow/gitblit:v1.9.1
四、部署Gitblit应用
1.创建部署目录
[root@jeven ~]# mkdir -p /data/gitblit/
[root@jeven ~]# cd /data/gitblit/
[root@jeven gitblit]#
2.创建Gitblit容器
docker run直接创建Gitblit容器
[root@jeven gitblit]# docker run -d --name gitblit --restart always -p 8080:8080 -p 8443:8443 -p 9418:9418 -p 29418:29418 -v /data/gitblit/data:/opt/gitblit-data jacekkow/gitblit:v1.9.1
c06563e50fc74c20fd5499e6bd0a8b470f90f808fd2c007014b58a6d113d4ded
3.检查Gitblit容器状态
[root@jeven gitblit]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c06563e50fc7 jacekkow/gitblit:v1.9.1 "/bin/sh -c /run.sh" 25 seconds ago Up 24 seconds 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp, 0.0.0.0:9418->9418/tcp, :::9418->9418/tcp, 0.0.0.0:29418->29418/tcp, :::29418->29418/tcp gitblit
4.检查Gitblit容器运行日志
检查Gitblit容器运行日志,查看是否有报错,Gitblit正常启动。
docker logs gitblit
五、访问Gitblit首页
1.访问Gitblit首页
http://192.168.3.166:8080/
2.登录Gitblit
初始账户:admin/admin
3.https访问Gitblit服务器
https://192.168.3.166:8443/