docker安装gitea
文章摘要
Gitea是一个开源轻量级代码托管平台,基于Go语言开发。本文介绍如何使用Docker安装Gitea:先拉取镜像,再运行容器并映射端口,最后通过Web界面配置数据库和管理员账户,完成部署。
> Gitea 是一个开源社区驱动的轻量级代码托管解决方案,后端采用 Go 编写,采用 MIT 许可证. 官网:[https://gitea.io/zh-cn/](https://gitea.io/zh-cn/) github:[https://github.com/go-gitea/](https://github.com/go-gitea/) ### [](https://blog.csdn.net/bigbear00007/article/details/124238812)获取 `gitea` 镜像 docker hub:[https://hub.docker.com/r/gitea/gitea](https://hub.docker.com/r/gitea/gitea) ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/d8c9e085f6db46c98949cb79f1c0850f.png) 复制命令下载镜像 ```java docker pull gitea/gitea ``` ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/e671190374ce4497a5ed359409950cd0.png) 通过 `portainer` 也可以看到下载的镜像 ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/36653701e9d3408e8e6c2ecaec3d155d.png) ### [](https://blog.csdn.net/bigbear00007/article/details/124238812)运行容器 在服务器中创建一个 `gitea` 目录用于存储容器文件,主要是为了方便管理 `docker` ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/92c8758a76bd45f888fd22b4cb463f6c.png) 通过以下命令运行容器 ```java docker run -d --name=gitea --privileged=true --restart=always -p 10022:22 -p 10080:3000 -v /usr/docker/gitea:/data gitea/gitea:latest ``` | 命令 | 描述 | | :-- | :-- | | –name gitea | 启动容器的名字 | | \-d | 后台运行 | | \-p 10022:22 | 将容器的 22 (后面那个) 端口映射到主机的 22 (前面那个) 端口 | | –restart=always | 容器重启策略 | | \-v /usr/docker/gitea:/data | 设置 `gitea` 存储目录为 `/usr/docker/gitea` | | gitea/gitea:latest | 使用 `gitea:latest` 镜像 | ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/7cbfb749ef394cae9d822f05efd229ac.png) 通过以下命令查看正在运行的容器 ```java docker ps ``` ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/f39b575208a248d898214afb15a80251.png) 在容器列表中出现了 `gitea` 容器 ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/b3fbbb72e26d49cb8227b45ef2fd2ca9.png) 在 `portainer` 中可以看到 `gitea` 容器 ### [](https://blog.csdn.net/bigbear00007/article/details/124238812)配置 `gitea` 访问 `http://ip:10800`,点击注册,没有配置的情况下会进入配置页面如下 ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/b517e30b60734743b286d42c47a4dcb6.png) 此处数据库我使用了 `Mysql` , 如需了解如何安装 `Mysql` 可查阅文章 《[docker安装mySQL 8](https://obear.blog.csdn.net/article/details/123978683)》 ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/282a5cd018e049f7841cd4172f4dcf50.png) 设置一个管理员和密码,然后点击 “立即安装”,安装需要等待一段时间。 ![在这里插入图片描述](https://oss.120120.top/blog/2024/01/09/974c13da832343a6a6f661bdb2553f5a.png) 安装完成后,可以看到以上界面。 详细的配置,可参考官方文档:[https://docs.gitea.io/zh-cn/config-cheat-sheet/](https://docs.gitea.io/zh-cn/config-cheat-sheet/) 本文转自 [https://blog.csdn.net/bigbear00007/article/details/124238812](https://blog.csdn.net/bigbear00007/article/details/124238812),如有侵权,请联系删除。
作者头像
admin
分享技术与生活
打赏作者

评论

暂无评论,快来抢沙发吧~