harness / gitness

Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.
https://gitness.com
Apache License 2.0
32.09k stars 2.8k forks source link

Docker-in-Docker sample don't works #3422

Closed MagicFun1241 closed 10 months ago

MagicFun1241 commented 10 months ago

pipeline:

kind: pipeline
spec:
  stages:
  - type: ci
    spec:
      volumes:
      - name: dockersock
        spec: {}
        type: temp
      steps:
      - name: dind
        type: background
        spec:
          container:
            image: docker:dind
            privileged: true
          mount:
          - name: dockersock
            path: /var/run

      - name: test
        type: run
        spec:
          container: docker:dind
          mount:
          - name: dockersock
            path: /var/run
          script: |-
            sleep 5
            docker ps -a

compose.yml

version: '3.3'
services:
    gitness:
        volumes:
            - '/var/run/docker.sock:/var/run/docker.sock'
        cap_add:
            - SYS_ADMIN
            - NET_ADMIN
        privileged: true
        image: harness/gitness

dind logs:

Certificate request self-signature ok
subject=CN = docker:dind server
/certs/server/cert.pem: OK
Certificate request self-signature ok
subject=CN = docker:dind client
/certs/client/cert.pem: OK
ip: can't find device 'ip_tables'
ip_tables 32768 11 iptable_mangle,iptable_nat,iptable_filter
x_tables 40960 26 xt_state,xt_REDIRECT,xt_ipvs,xt_policy,xt_bpf,iptable_mangle,xt_u32,xt_multiport,xt_nat,xt_MASQUERADE,xt_mark,ip6t_REJECT,xt_hl,ip6t_rt,ipt_REJECT,xt_LOG,xt_comment,xt_limit,xt_addrtype,xt_tcpudp,ip6table_filter,ip6_tables,xt_recent,xt_conntrack,iptable_filter,ip_tables
modprobe: can't change directory to '/lib/modules': No such file or directory
mount: permission denied (are you root?)
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.
mount: permission denied (are you root?)
airycanon commented 10 months ago

@MagicFun1241 Hello, I've come across the same issue as described here. May I ask how you managed to solve it?

MagicFun1241 commented 10 months ago

Unfortunately, I didn't get to solve the issue with Docker in Docker, so I switched to pipeline with caprover cli