Ubuntu+docker+gitlab安装和使用

以前自己写的代码都是在本地,因为都是自己一个人维护,现在交给团队维护了,所以想着搭建一个gitlab

1,拉镜像

安装非常简单

docker search gitlab  搜索镜像

docker pull gitlab/gitlab-ce 拉取镜像

docker images 查询镜像

2,创建本地映射文件

test-team-server:~$ mkdir gitlab
test-team-server:~$ cd gitlab/
test-team-server:~/gitlab$ mkdir config logs data

3,安装

docker run --detach -p 8843:443 -p 8090:80 -p 2222:22 --name gitlab --restart always -v /home/dapeng/gitlab/config:/etc/gitlab -v /home/dapeng/gitlab/logs:/var/log/gitlab -v /home/dapeng/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce


docker ps -a | grep gitlab

docker logs -f gitlab

4,配置

访问gitlab http://192.168.1.119:8090

(1)设置密码,初始账户为root,设置密码之后就可以登录了

(2)进入容器docker exec -it gitlab bash

gitlab配置文件路径:/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

修改完相关配置文件,都要执行一次

gitlab-ctl reconfigure

(3)重启、启动、停止、状态

gitlab-ctl restart  // 重启

gitlab-ctl stop      // 停止

gitlab-ctl start     // 启动

gitlab-ctl status  //状态

(4)网页上配置ssh

http://192.168.1.119:8090/profile/keys

 http://192.168.1.119:8090/help/ssh/README#generating-a-new-ssh-key-pair

在本机或者其他客户端上,输入

root@2b510dc55a9c:~# ssh-keygen -o -t rsa -b 4096 -C [email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:oYal4aUO176dnHGbScvqzcdcQlwIjQqt1+9PWEvV99M [email protected]
The key's randomart image is:
+---[RSA 4096]----+
| . .+ . |
| . . . o . .|
| . oo.o . . +|
| . O..o.. o .+|
| . * +.S o o.E|
| + o o+...|
| . . . o+.oo |
| + X ==. |
| ..B.O. .. |
+----[SHA256]-----+

复制pub里面的内容到gitlab页面上

cat /root/.ssh/id_rsa.pub

猜你喜欢

转载自www.cnblogs.com/happyuu-2019/p/11434963.html