I just upgraded gitea to 1.20.5 and want to try out actions. Intallation was seemingly easy, i just added a container for the runner configured and started ist. Activated the actions feature in gitea. The runner is visible under the runners section.
If i want to execute the demo action from the docs, it can not fetch the repo with git fetch. The log hints to a connection problem:
fatal: unable to access 'http://<gitea>/<repo>/': Failed to connect to <gitea> port <gitea-port>: Connection refused.
The port and hostname is correct. I wonder if its a docker network issue or similar? I’m not as firm with docker as i wished, so there is a good possibility that i messsed that up. I added the runner container to the network the gitea instance is also in, with no success…
I checked, the gitea server is reachable from within the runner container. What’s very strange is, if i mimic the operations the runner is doing manually by connection to the runner container and pasting them to the command line - it works…
I can narrow it down to the fact that the host is not reachable if the script is executed by the runner, but it is reachable if i connect to the runner container and check myself. Something is different…
I reduced the peline script to just a wget <gitea>. Which resolves to the host IP if i do it manually and the docker IP of the gitea instance if it’s done by the runner script. Something is borked with the network, it seems to me that this is no gitea or act_runner problem.
Maybe, (but its a long shot and it has bitten me a long time ago once), you can check the environment inside the container for proxy variables that may have been set.
I remember having had a container in a dedicated environment, where a wrong no_proxy variable was set, when the container started by systemd for the main process, but it was not present, when later on we ‘docker exec’-ed into the container …
only a cat /proc/$PID/env of the runners pid showed us the wrong variable, which led to "cannot connect to … "
I think /config.yaml is exactly the problem in most cases since the runner will startup a new container in default container network.
You need to specify the network in as known to docker so in case of docker-compose including prefix.
Because I found this topic and was confused by the explanation:
I was having the same issue, using Docker Compose, actions/checkout would fail trying to access https://gitea:3000 (the Docker internal name).
My Compose file had the correct links specification on the runner, however what they are talking about above is that the action instances are being assigned to the wrong network.
To fix that, I had to add a configuration file to the runner, using the generated config as a base, then change container.network to be the name of the network Gitea and the runner are on instead of the default empty string.
I have encountered the same error problem, unable to connect to the repository. However, I have installed Gitea and the runner using binary files, not using Docker. Could you give me any good solutions?
For anyone who still struggles with this issue: Host not found! Here are the steps: I am using GiteaVersion:1.23.1.
1- When using docker compose we have to specify the network: for example
networks:
gitea_net:
2- The Gitea and Gitea runner must have the same network:
networks:
- gitea_net
3- The config.yaml is a MUST. The config file can be generated for docker using:
docker run --entrypoint="" --rm -it docker.io/gitea/act_runner:latest act_runner generate-config > config.yaml
This will generate the config.yaml. Copy to your docker-compose location.
4- Type the name of the network in the config.yaml:
container:
network: "gitea_gitea_net"
You MUST add the docker compose network name. My docker-compose name is gitea and then add the underscore.
5- The final should be like this: