Home  >  Q&A  >  body text

docker gitlab 如何git clone?

它给的SSH和http地址是这样的:

git@6b30d4a6a162:compontent/gitlab-test-component.git
http://6b30d4a6a162/compontent/gitlab-test-component.git

6b30d4a6a162是gitlab的container Info的ID的一部分:

6b30d4a6a16279326a135ee2c7bf7b20094b3199a299ac6345735dd3

我通过上面两个地址都无法git clone。

因为我用virtualbox简单的做了一下端口映射,所以我尝试用

git clone http://localhost:8100/compontent/gitlab-test-component

但会报错:500

有知道的吗?

另外想问一下,ssh-key是不是只要生成一次就行了,可以到处放github、gitlab,或者其他地方的,都是同一份?

PHP中文网PHP中文网2705 days ago1019

reply all(3)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-04-26 09:03:10

    Because port 22 of the host has been occupied

    Map the 22 port of the container to other ports of the host such as 2222 when docker run

    docker run gitlab -p 2222:22

    You need to specify the url in the gitlab configuration file

    # 修改 /etc/gitlab/gitlab.rb 文件第一行
    
    external_url 'http://192.168.1.23/'

    This is what will be displayed in the project warehouse

    git@192.168.1.23:2222/shadowsocks/shadowsocks.git

    Then you can use git

    git clone git@192.168.1.23:2222/shadowsocks/shadowsocks.git

    At this time, you need to configure the .ssh/config file on the development machine to use it normally

    The following is an example of using docker to run gitlab

    docker run --name='gitlabend' --link gitlab_mysql:mysql \
      --link gitlab_redis:redisio \
      -e 'GITLAB_PORT=10080' \
      -e 'GITLAB_SSH_PORT=10022' \
      -p 10022:22 -p 10080:80 \
      -e 'GITLAB_HOST=xxxx' \
      -e 'GITLAB_EMAIL=user@mail.com' \
      -e 'SMTP_ENABLED=true' \
      -e 'SMTP_DOMAIN=qq.com' \
      -e 'SMTP_HOST=smtp.exmail.qq.com' \
      -e 'SMTP_PORT=25' \
      -e 'SMTP_STARTTLS=false' \
      -e 'SMTP_USER=user@mail.com' \
      -e 'SMTP_PASS=password' \
      -e 'SMTP_AUTHENTICATION=login' \
      -v /opt/gitlab/data:/home/git/data \
      -v /opt/gitlab/log:/var/log/gitlab \
      sameersbn/gitlab:latest

    reply
    0
  • PHP中文网

    PHP中文网2017-04-26 09:03:10

    There is something wrong with the usage. It is definitely not using docker’s container name as the domain name. You have to bind a domain name or use ip + port access to clone it.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-26 09:03:10

    @Tairy, didn’t I use domain name + port above?

    That’s rightlocalhost:8100, but it will report a 500 error. .

    Can you tell me how you bind it?

    reply
    0
  • Cancelreply