问题记录:VM-Ubuntu20.04刚开始时使用NAT模式连接,后来改成桥接模式,改完之后原来使用docker启动的gitlab服务无法克隆,一直提示:fatal...没有远程库什么的,没解决后来删除映射目录和容器、镜像,重新启动了新的容器,配置后可以进行ssh克隆但是无法通过http克隆,进行gitlab-ci流水线时提示Failed to connect to 192.168.xx.83 port 80: Connection refused

通过尝试使用命令:git clone http://192.168.1.83/liutaiqiang/test.git 无法克隆提示:Failed to connect to 192.168.xx.83 port 80: Connection refused

通过尝试使用命令:git clone http://192.168.1.83:9001/liutaiqiang/test.git 可以进行克隆,在/srv/gitlab/data/gitlab-rails/etc下修改gitlab.yml把端口80改为9001后重启gitlab服务,又会变回80端口

通过以下方式进行修改,解决了问题

自定义使用的端口

查看容器的ID

wmg@debian:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1132de0d1960 gitlab/gitlab-ce:latest "/assets/wrapper" 19 hours ago Up 2 minutes (healthy) 80/tcp, 443/tcp, 0.0.0.0:8081->8081/tcp, 0.0.0.0:10022->22/tcp gitlab

记住CONTAINER ID

在做操作之前,为了防止意外,先将容器和docker停了

docker stop gitlab         // 停止容器,gitlab是容器的名字
systemctl stop docker // 停止docker

我们需要将http的端口改为访问9001,同时在克隆的时候的地址是对的,gitlab的ssh的端口改为宿主机的8022。

修改宿主机的 /var/lib/docker/containers/容器ID/ 目录下的config.v2.json,hostconfig.json文件

root@debian:~# cd /var/lib/docker/containers/1132de0d1960e1049a3f1f014b2ba215442a6c7f23f4983b324e055306822c52/
root@debian:/var/lib/docker/containers/1132de0d1960e1049a3f1f014b2ba215442a6c7f23f4983b324e055306822c52# ls
1132de0d1960e1049a3f1f014b2ba215442a6c7f23f4983b324e055306822c52-json.log checkpoints config.v2.json hostconfig.json hostname hosts mounts resolv.conf resolv.conf.hash

config.v2.json

hostconfig.json

Tips:使用vim编辑是如果没有格式化的话,可读性会非常差,我是把文件复制到本地用notepad++改的

修改容器内的gitlab配置文件/etc/gitlab/gitlab.rb

因为我将/etc/gitlab映射到了/backup/gitlab/config下了,所以我直接进这个目录修改gitlab.rb文件,以下几行参数

external 'http://192.168.88.213:8081'
nginx['listen_port'] = 8081
gitlab_rails['gitlab_shell_ssh_port'] = 10022

改好之后将docker和容器启动就好了

systemctl start docker

docker start gitlab

文字参考:https://www.cnblogs.com/FFFirer/p/docker_gitlab.html

GitLab能通过ssh克隆无法通过http克隆,也无法进行流水线,提示port 80: Connection refused的更多相关文章

  1. ssh: connect to git@gitlab.xxxxx.com:xxxxx.git port 22: Connection refused

    公司服务器上的gitlab项目添加了ssh密钥,但是操作时却报错ssh: connect to git@gitlab.xxxxx.com:xxxxx.git port 22: Connection r ...

  2. 新手git: ssh: connect to host localhost port 22: Connection refused

    由于gitlab上要git pull或者git clone,可是每次都出现这个问题.之前偶尔出现这个问题.可是仅仅是偶尔.这是为什么呢?然后就開始搜索网上的解决方式了. 这个问题搜索网上非常多答案.可 ...

  3. ssh: connect to host github.com port 22: Connection refused

    假设git例如,下面的问题时,远程推送: [fulinux@ubuntu learngit]$ git push -u origin master ssh: connect to host githu ...

  4. Ubuntu下 ssh : connect to host localhost port 22:Connection refused

    Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhost port 22:Connection refused 造成这个错误的原因 ...

  5. 运行Hadoop start-all.sh遇到的错误ssh: connect to host localhost port 22: Connection refused

    ssh: connect to host localhost port 22: Connection refused 我的情况是ssh server没装,查看方法: ps -e |grep ssh 1 ...

  6. scp出现ssh port 22: Connection refused 问题解决具体步骤

    [root(0)@sys11 09:20:29 /home/work/Code_release/bj]# scp ./release.sh  root@192.168.161.151:/Users/a ...

  7. ssh: connect to host localhost port 22: Connection refused

    1.hadoop安装好之后,执行ssh localhost无法执行, 提示“ssh: connect to host localhost port 22: Connection refused”. 2 ...

  8. ssh本机失败(ssh: connect to host localhost port 22: Connection refused)

    ssh本机失败(ssh: connect to host localhost port 22: Connection refused) 一. 问题描述 之前一直在服务上使用宝塔面板, 今天突发奇想, ...

  9. 阿里云配置通用服务的坑 ssh: connect to host 47.103.101.102 port 22: Connection refused

    1.~ wjw$ ssh root@47.103.101.102 ssh: connect to host 47.103.101.102 port 22: Connection refused ssh ...

  10. ssh: connect to host localhost port 22: Connection refused 问题

    错误原因:1.sshd 未安装2.sshd 未启动 3.防火墙 4需重新启动ssh 服务 解决方法:1.确定安装sshd: $ sudo apt-get install openssh-server ...

随机推荐

  1. Coolify系列-解决WARNING: IPv4 forwarding is disabled. Networking will not work.以及开启防火墙端口

    背景 我在windows电脑安装了一个VM,使用VM开启了Linux服务器,运行docker,然后遇到了这个报错. 解决 首先:在宿主机上执行 echo "net.ipv4.ip_forwa ...

  2. html内容超宽后,缩小可视区域后,会引起部分背景色宽度出现显示异常情况,解决如下:

  3. Codeforces Round #601 (Div. 2) A-E

    比赛链接 A 题意 给两个数字 \(a,b\) ,每次操作可以使 \(a\) 加上 \(+1,+2,+5,-1,-2,-5\) 中的一个数,求最少多少次操作可以将 \(a\) 变成 \(b\) . 题 ...

  4. FLASH-CH32F103替换STM32F103 FLASH快速编程移植说明

    因CH32F103 相对于STM32F103 flash 操作多了快速编程模式,该文档说明主要目的是为了方便客户在原先ST 工程的基础上实现flash 快速编程模式的快速移植. 1.在stm32f10 ...

  5. Ubuntu下安装cURL库用于libcurl开发

    http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.22.0.orig.tar.gz 不要问我为什么,根据cURL主页的下载向导给的就是这 ...

  6. drf-day2——restful规范、序列化反序列化、基于django编写五个原生接口、drf介绍和快速使用、cbv源码分析

    目录 一.restful规范(重要,不难) 概念 十个规范 二.序列化反序列化 三.基于django原生编写5个接口 四.drf介绍和快速使用 概念 安装 代码 五.cbv源码分析 六.作业 1.使用 ...

  7. 洛谷p1423

    1 #include<bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 double n;//n:要游的距离 6 cin&g ...

  8. springcloud12-spring cloud stream

    1.基础说明 官网:https://spring.io/projects/spring-cloud-stream#overview   文档:https://docs.spring.io/spring ...

  9. 关于我在学习LFU的时候,在开源项目捡了个漏这件事。

    你好呀,我是歪歪. 这篇文章带大家盘一下 LFU 这个玩意. 为什么突然想起聊聊这个东西呢,因为前段时间有个读者给我扔过来一个链接: 我一看,好家伙,这不是我亲爱的老朋友,Dubbo 同学嘛. 点进去 ...

  10. LC761.特殊的二进制序列

    import org.junit.jupiter.api.Test;import java.util.ArrayList;import java.util.Collections;import jav ...