[root@test gitlab] ./gitlab_start.sh docker: Error response from daemon: Conflict. The container name "/gitlab" is already in use by container "000dc7b1b6e35d94171be203c49ef7a57a1ffb8ea76c72b6765cbed9b5de347b". You have to remove (or rename) that container to be able to reuse that name. See 'docker run --help'.
这是因为之前的容器虽然没有运行起来,但是已经创建了,把它删除掉
1 2 3 4 5 6 7
[root@test gitlab] docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 000dc7b1b6e3 gitlab/gitlab-ce:latest "/assets/wrapper" 7 minutes ago Created gitlab [root@test gitlab] docker rm 000d 000d [root@test gitlab] docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
重新运行gitlab_start.sh文件
1 2 3 4 5
[root@test gitlab] ./gitlab_start.sh 70b9da8332b287b9c154988e03eb6b92ba6c360f985d704b1b703367ffe30732 [root@test gitlab] docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 70b9da8332b2 gitlab/gitlab-ce:latest "/assets/wrapper" 4 seconds ago Up 3 seconds (health: starting) 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:10080->22/tcp, :::10080->22/tcp, 0.0.0.0:8088->80/tcp, :::8088->80/tcp gitlab
可以看到容器成功启动
3.2创建方法二
创建docker-compose.yml文件,并在该文件所在的文件夹目录下运行docker-compose up -d 需要事先安装docker-compose 安装docker-compose
Try fixing it: Make sure GitLab is running; Check the gitlab-shell configuration file: sudo -u git -H editor /opt/gitlab/embedded/service/gitlab-shell/config.yml Please fix the error above and rerun the checks.
查看上述配置文件,查找错误原因
访问GitLab失败错误
虽然容器启动成功,但是却没办法根据ip:port访问gitlab
启动一个tomcat容器测试端口
拉取tomcat镜像
1
docker pull tomcat:jdk8-openjdk
为了测试8088端口是否可用,先把gitlab的容器暂停
1
docker stop gitlab
启动tomcat容器,并将tomcat容器的8080端口映射到宿主机的8088端口
1 2 3 4 5 6 7 8 9 10
[root@test ~] docker run -d --name tomcat -p 8088:8080 tomcat:jdk8-openjdk aa29b816196ae32f12915a74e447f01bedae64cd200aaa5cab0dedcc383710f7 [root@test ~] docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES aa29b816196a tomcat:jdk8-openjdk "catalina.sh run" 3 seconds ago Up 3 seconds 0.0.0.0:8088->8080/tcp, :::8088->8080/tcp tomcat [root@test ~] lsof -i:8088 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME docker-pr 2257 root 4u IPv4 2690446 0t0 TCP *:radan-http (LISTEN) docker-pr 2262 root 4u IPv6 2689770 0t0 TCP *:radan-http (LISTEN)
一切正常,访问ip:8088,还是和以前一样访问不了
开启防火墙并打开端口
因为之前系统的防火墙一直是关闭的并且其它的服务能正常访问,所以没有怀疑是防火墙的问题
1 2 3 4
[root@test ~] firewall-cmd --state not running [root@test ~] firewall-cmd --permanent --add-port=8088/tcp FirewallD is not running
GitLab Shell: ... GitLab Shell version >= 13.19.0 ? ... OK (13.19.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... GitLab Instance / Monitoring ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.31.0 ? ... yes (2.32.0) Git user has default SSH configuration? ... yes Active users: ... 1 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
一切正常
我再次换成tomcat容器进行测试,发现8088端口访问不了了。
但是在宿主机内ping本机是可以的
1 2
[root@test tomcat] curl localhost:8088 <!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/9.0.50</h3></body></html>