Is docker in docker going to be available soon?

Hi,

Maybe I am missing something and cant find it, but I would like to run self hosted runners as part of the kubernetes cluster and would like to use docker in docker if possible for creating and building my docker images and pushing them to the private repo etc…
I could not find something like this, so just wondering is it going to be available soon or there is something natively created by github to support this?

Best regards,

@UrosCvijan ,

When running workflows on the self-hosted runners:

Thank you for the answer @brightran.

Is there any development toward having docker in docker as a possible way of doing build/deployments etc… ?

Regards,

Uros

@UrosCvijan ,

Do you mean build, run or publish a Docker image in another Docker container?
If so, yes, it is possible.
For example, you have two Docker images (image-1 and image-2) and their corresponding Dockerfile are Dockerfile-1 and Dockerfile-2.

You build and run image-1 on the runner:

  • When you run image-1 (docker run), you may need to set volumes for the container to share the directory of image-2 between the container and the runner machine.

  • You also need to setup Docker environment (install Docker) in the container of image-1, so that you can execute docker commands to build, run, and publish image-2.

Hi @brightran,

I meant, for the runner to be in Kubernetes as a docker. And from that runner to run docker commands. Basically not to have a virtual machine, but only a docker runner from which I would do everything. Something similar as there is in GitLab with their runners, to have the runner, and then I just specify the image (node:latest for example), i do all the which I want to use for the specific build. So I do all my actions in the docker, code is pulled in the docker itself I do the whole docker build, docker push commands.
But as you stated, for docker commands to run I would need docker installed inside of that docker (so i need to bring the runner in a docker image with docker already installed), or for Container actions it needs to be the Linux machine with docker installed on it.

My idea was to not have a separate server just for the runner service, but to use K8s cluster and use dockers to the build and deploy. To put it in the most easy way possible :slight_smile:

@UrosCvijan ,

Basically not to have a virtual machine, but only a docker runner from which I would do everything.

To run a Docker container, the hosted machine is required (local machine or virtual machine).

According to your description, I think that using your runner image to setup a container job (jobs.<job_id>.container) should work.

Any steps in the job that don’t already specify a container will run in the same container you specify, and the container actions run as sibling containers on the same network with the same volume mounts.

@brightran, I think @UrosCvijan is asking if there will be able support for some sort of deployment.yaml that sorts out the Docker sidecar to run Docker actions within the self-hosted runner.

@UrosCvijan, if this is right, then I don’t know if it’s in the scope of actions/runner to do this, but to just provide the runner itself.

That being said, there are several projects that have solved this issue. I ended up rolling my own, but there are some pretty good ones out there.

Here are some links to some topics and projects: