How to (really) debug a (docker) build locally?

Maybe I am missing something or it doesn’t work on my machine, but How to debug a build locally seems to only describe how to set up an empty docker container.

The most important part is missing: How to get the volume with the project files?

Since the container doesn’t have git let alone SSH keys, I can’t simply check them out. This container is really no different from any other freshly set up Docker container. What am I missing?

Hi AndreKr,

I was fighting with this in the past and I move to a shell executor. See my ci file.

Everything its a little bit more manual, but I can have full control about what I’m doing and replicate on my local easily.

Good luck!

I also use only vms plus shell executors.

If you really want to ssh into your containers you’ll have to set them up with a running sshd, authorized keys, git, etc.

You may take a look at Workflow. If you use the docker runner the checkout is done by the mentioned special docker image but after the services are created in the prebuild step. Otherwise you could not use the busybox image, e.g. The special image is embedded in the go binary of the runner. If you use the kubernetes runner, the documentation states, that the build image has to include git for checking out the sources and even the gitlab-runner binary for caching and saving artifacts. git checkout is done using https with a special token because the runner “knows” that it can access the gitlab server via https as this is the method it connects anyway.