iT邦幫忙

0

Docker Compose 建立 GitLab 容器,執行器 Runner 運行流水線問題

  • 分享至 

  • xImage

我的作業系統是 Windows 11
用 Docker Compose 建立一個 GitLab 及 GitLab Runner的容器
docker-compose.yml 檔案內容如下

version: '3.8'

services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    container_name: gitlab
    restart: always
    hostname: gitlab
    ports:
      - "80:80"
      - "443:443"
      - "22:22"
    volumes:
      - .gitlab-config:/etc/gitlab
      - .gitlab-logs:/var/log/gitlab
      - .gitlab-data:/var/opt/gitlab
    shm_size: '256m'
    networks:
      - gitlab-network

  gitlab-runner:
    image: gitlab/gitlab-runner:latest
    container_name: gitlab-runner
    restart: always
    depends_on:
      - gitlab
    volumes:
      - .gitlab-runner-config:/etc/gitlab-runner
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - gitlab-network

networks:
  gitlab-network:
    driver: bridge

執行器Runner狀態
https://ithelp.ithome.com.tw/upload/images/20250919/20061169jTmylMwOkH.jpg
執行器Runner設定內容
https://ithelp.ithome.com.tw/upload/images/20250919/20061169Wco9o51qO6.jpg
建立了一個專案 ci-cd-demo
.gitlab-ci.yml內容如下

helloworld:
  script:
    - echo "hello world, GitLab!"   

執行錯誤畫面
https://ithelp.ithome.com.tw/upload/images/20250919/20061169J6eYzotdzf.jpg
錯誤訊息
fatal: unable to access 'http://gitlab/root/ci-cd-demo.git/': Failed to connect to gitlab port 80 after 3 ms: Could not connect to server
Retrying in 5s
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

請問各位前輩該如何排除問題?

圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答