# Using Docker images from private repository to run actions in

**URL:** <https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571>\
**Category:** Actions\
**Created:** [February 14, 2024, 8:40pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571 "2024-02-14T20:40:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlyveHest](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/flyvehest/32/4388_2.png) [@FlyveHest](https://forum.gitea.com/u/FlyveHest)\
**Post date:** [February 14, 2024, 8:40pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/1 "2024-02-14T20:40:46Z")

</div>

Hi everyone, I am in the process of migrating my CI setup from Drone to using Gitea Actions, and I have run into a problem, which might stem from me not completely understanding how to configure my runner correctly.

What I am trying to do is being able to run my actions in a docker image from my private repository, as its set up with various tools and keys that are “burned” into the image, but it doesn’t seem like the runner can use images that are not on the public Docker repository?

According to the docs, I think I would need to setup a label something like this:

> my-private-tag: **url-to-private-repository** ://myimage:latest

But, I can’t seem to find any mention on how to supply credentials, a PAT or anything anywhere.

Is this possible currently in Gitea?

My previous setup in Drone did this, and at work we use GitLab where I can also supply credentials and URLs for a private Docker image repository.

---

<div class="post-metadata">

**Author:** ![mstup](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/mstup/32/4392_2.png) [@mstup](https://forum.gitea.com/u/mstup)\
**Post date:** [February 16, 2024, 3:32pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/2 "2024-02-16T15:32:34Z")

</div>

Hi,  
I did it for case then Gitea and my custom Docker image are both one Docker engine.

---

<div class="post-metadata">

**Author:** ![p7k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/p7k/32/4234_2.png) [@p7k](https://forum.gitea.com/u/p7k)\
**Post date:** [February 16, 2024, 5:05pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/3 "2024-02-16T17:05:08Z")

</div>

If you control the Gitlab Runner yourself, you could simply log in with `docker login <registry>` beforehand. Then the runner has access to the private images. This is how I do it here.

---

<div class="post-metadata">

**Author:** ![FlyveHest](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/flyvehest/32/4388_2.png) [@FlyveHest](https://forum.gitea.com/u/FlyveHest)\
**Post date:** [February 16, 2024, 7:30pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/4 "2024-02-16T19:30:02Z")

</div>

But, how would I specify that it should use my repository and not the default dockerhub?

It might be that I just don’t fully understand how the runner bootstraps the images, though.

I do think I have found a solution by reading the Github workflow docs, and I think that I have to specify the image to use in the yml file itself, using the `container` and `image` keywords, it looks like I can specify a full path and credentials that way, I just haven’t had time to try it yet.

---

<div class="post-metadata">

**Author:** ![p7k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/p7k/32/4234_2.png) [@p7k](https://forum.gitea.com/u/p7k)\
**Post date:** [February 16, 2024, 8:46pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/5 "2024-02-16T20:46:47Z")

</div>

Exactly. It will look like this

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: "ghcr.io/catthehacker/ubuntu:act-22.04"

```

Then you can use any image you want. You just have to make sure that the right tools are installed (e.g. NodejS). This is what makes Gitea Actions different from the Gitlab Runner, for example. There it really doesn’t matter what is in the image, because it doesn’t have such strict dependencies.

---

<div class="post-metadata">

**Author:** ![FlyveHest](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/flyvehest/32/4388_2.png) [@FlyveHest](https://forum.gitea.com/u/FlyveHest)\
**Post date:** [February 17, 2024, 9:28am UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/6 "2024-02-17T09:28:50Z")

</div>

Ah, there are requirements for the image?

Do you know what they are, I haven’t been able to find a definitive list.

Is this just to be able to, for instance, run actions? Or are there basic requirements for the image to function at all?

---

<div class="post-metadata">

**Author:** ![p7k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/p7k/32/4234_2.png) [@p7k](https://forum.gitea.com/u/p7k)\
**Post date:** [February 18, 2024, 1:36pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/7 "2024-02-18T13:36:35Z")

</div>

No, I am not aware of a specific list either. It also depends very much on which action modules you want to use at all (e.g. docker, then you need the docker tools). In any case, you will probably need NodeJS. Just try it out. If something is missing, you’ll notice it. 😉

---

<div class="post-metadata">

**Author:** ![kcrawford](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@kcrawford](https://forum.gitea.com/u/kcrawford)\
**Post date:** [February 18, 2024, 9:51pm UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/8 "2024-02-18T21:51:18Z")

</div>

Here is an example of an image I build and then store on my gitea instance.

I wanted a docker image that could compile a go binary and also push the complied binary to my gitea instance. My Dockerfile looks like this:

```auto
FROM alpine

RUN apk add --update-cache \
    rsync \
    openssh-client \
    tzdata \
    git \
    curl \
    jq \
    && rm -rf /var/cache/apk/*

COPY --from=golang:1.21-alpine /usr/local/go/ /usr/local/go/

ENV PATH="/usr/local/go/bin:${PATH}"

CMD ["/bin/sh"]

```

I also had to run `docker login` and specify the URL of my gitea instance. SSL is a ‘requirement’. There are ways of disabling SSL checks and using port 80 instead but I found it to be a headache.

The command I use to build and push the image is:

```auto
docker buildx build --no-cache --platform linux/amd64,linux/arm64 --output type=registry -t <gitea_domain>/kcrawford/$(basename $(pwd) | tr 'A-Z' 'a-z'):0.0.4 .

```

The basename of pwd just ends up being `gobuilder` (lowercase) in my case, this was a portable way of using the name of the directory as the name of the image. The image also needs a version tag, and I am on revision 4 of my particular image.

This step also builds both an arm and AMD version of the image because I am running my gitea instance on an Orange Pi but also have a desktop for testing.

Then, when I want to use the image in a gitea action, I have:

```auto
jobs:
  build:
    runs-on: gobuilder
    container:
      image: gobuilder:0.0.3

```

Let me know if this helps clear things up.

---

<div class="post-metadata">

**Author:** ![CJLove](https://avatars.discourse-cdn.com/v4/letter/c/e56c9b/32.png) [@CJLove](https://forum.gitea.com/u/CJLove)\
**Post date:** [February 22, 2024, 3:35am UTC](https://forum.gitea.com/t/using-docker-images-from-private-repository-to-run-actions-in/8571/9 "2024-02-22T03:35:12Z")

</div>

An approach I’m using for a lot of local pipelines on my self-hosted gitea instance is to have the pipeline use `ubuntu-latest`, specifying `catthehacker/ubuntu:act-latest` as a docker-capable image to use.

In the steps I then use `https://github.com/addnab/docker-run-action@v3` to run a specific image from my local registry.

This is an example of a local pipeline I do, where I also use the matrix strategy to use a family of images exercising different compiler versions.

> <https://github.com/CJLove/msglib-cpp/blob/master/.gitea/workflows/ci.yml>

I’m still figuring out some things as well, so this is very much still a work in progress. I was previously using Concourse for my local CI/CD.
