#.gitlab-ci.yml without docker-in-docker

1 messages · Page 1 of 1 (latest)

ocean saddle
#

I want to run a go dagger ci pipline on gitlab. Problem is the runner is already a container and hence docker-in-docker is not possible. Any examples of a .gitlab-ci.yml avaiable in this case?

ocean saddle
#

Any hints on how to run it is also possible.

pure lichen
#

Good question, typically container-based runners have a way to give your container extra privileges. In this case you want the ability to access the underlying docker engine socket. Another option is to setup the dagger engine in "rootless" mode, which will require some tweaking on our end

#

Are you able to share your gitlab configuration?

hearty sundial
#

Maybe something like this works

docker-build-backend:
  image: docker:stable-dind
  stage: docker-build
  variables:
    # Tell docker CLI how to talk to Docker daemon; see
    # https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-executor
    DOCKER_HOST: tcp://thedockerhost:2375/
    # Use the overlayfs driver for improved performance:
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
  services:
    - name: docker:dind
      alias: thedockerhost
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
[[runners]]
  url = "https://gitlab.com/"
  token = TOKEN
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "docker:20.10.16"
    privileged = true                     <------ This here might be necessary in your config.toml
    disable_cache = false
    volumes = ["/cache"]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

More info and alternatives here:
https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-executor

clear lake
hidden ferry
pure lichen
hidden ferry
#

Yes

pure lichen
#

In that case, there is another solution that avoids DinD. You can run the Dagger engine as a sidecar container, and configure the dagger client in your CI runner to connect to that engine.

#

If you are running your Gitlab CI runners on Kubernetes, then that would be implemented with a Daemonset. This way, each node in your kubernetes cluster gets one dedicated engine. This maximizes horizontal scaling, and minimizes waste

hidden ferry
#

Can u provide some example please

pure lichen
hidden ferry
hidden ferry
#

Can I schedule a call on webex ?

pure lichen
#

I'm sure we can arrange that 🙂

hidden ferry
#

Does this describe what u talked about ?

pure lichen
#

that link shows me 404 for me..