# Can I build docker images if the action runner is a docker instance

**URL:** <https://forum.gitea.com/t/can-i-build-docker-images-if-the-action-runner-is-a-docker-instance/10129>\
**Category:** Actions\
**Created:** [November 26, 2024, 11:57pm UTC](https://forum.gitea.com/t/can-i-build-docker-images-if-the-action-runner-is-a-docker-instance/10129 "2024-11-26T23:57:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexlehm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/alexlehm/32/4646_2.png) [@alexlehm](https://forum.gitea.com/u/alexlehm)\
**Post date:** [November 26, 2024, 11:57pm UTC](https://forum.gitea.com/t/can-i-build-docker-images-if-the-action-runner-is-a-docker-instance/10129/1 "2024-11-26T23:57:53Z")

</div>

I am trying to use a Gitea installation to build an docker image from my project, which is currently limited to a runs-on: docker worker. I assume that this requires a Docker-in-docker image, but then it needs to connect to the host Docker service and that apparently does not work.

Currently I am trying to run docker info with

```auto
on: [push]
jobs:
  build:
    runs-on: docker
    container: 
        image: docker:dind
    steps:
      - run: docker info

```

and that complains that the .sock file is not accessible.

---

<div class="post-metadata">

**Author:** ![remram44](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/remram44/32/3152_2.png) [@remram44](https://forum.gitea.com/u/remram44)\
**Post date:** [November 29, 2024, 10:04pm UTC](https://forum.gitea.com/t/can-i-build-docker-images-if-the-action-runner-is-a-docker-instance/10129/2 "2024-11-29T22:04:48Z")

</div>

You _either_ run a Docker-in-Docker service, _or_ you mount the host’s Docker socket.

Another option is to use something like Kaniko, that will not require granting scary permissions to the build: [GitHub - GoogleContainerTools/kaniko: Build Container Images In Kubernetes](https://github.com/GoogleContainerTools/kaniko) GitLab has an example for their CI which you should be able to translate easily enough: [Use kaniko to build Docker images | GitLab](https://docs.gitlab.com/ee/ci/docker/using_kaniko.html)

---

<div class="post-metadata">

**Author:** ![simca](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/simca/32/6497_2.png) [@simca](https://forum.gitea.com/u/simca)\
**Post date:** [December 12, 2024, 12:08am UTC](https://forum.gitea.com/t/can-i-build-docker-images-if-the-action-runner-is-a-docker-instance/10129/3 "2024-12-12T00:08:36Z")

</div>

honestly … i just created act-runner docker image(from the base one) which included, docker-in-docker installation and coz it is alpine based, really easy to achieve:

```auto
apk --no-cache add docker docker-compose

```

- modify a bit `entrypoint.sh` with something like:

```auto
....
echo "Starting docker daemon ..."
dockerd 1>/dev/null 2>&1 &
...

```

As the downside, such runner requires privileged mode …
