devops - Docker安装GitLab

GitLab 代码仓库


查看GitLab镜像

docker search gitlab

拉取GitLab镜像

docker pull gitlab/gitlab-ce

准备 docker-compose

/usr/local/docker/gitlab_docker/docker-compose.yml

version: '3.1'
services:
  gitlab:
    image: 'gitlab/gitlab-ce'
    container_name: gitlab
    restart: always
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.31.101:8929'
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
    ports:
      - '8929:8929'
      - '2224:2224'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'

创建容器

docker-compose up -d

跟踪日志

docker logs -f gitlab

测试访问:

http://192.168.31.101:8929/ 默认账号root

进入容器获取密码:

docker exec -it gitlab base
cat /etc/gitlab/initial_root_password

文档信息

Search

    Table of Contents