Reputation: 1
when i run the command actions/checkout@v4
i get an error
I a gitea docker container running on ubuntu.
this is the docker compose file:
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
volumes:
- gitea-data:/data
ports:
- "3000:3000" # Gitea web interface
- "222:22" # SSH for Git access
networks:
- gitea_network
volumes:
gitea-data:
external: true
networks:
gitea_network:
driver: bridge
external: true
And a gitea action runner on a different docker (on the same server).
This is the runner docker compose:
services:
runner:
image: gitea/act_runner
environment:
GITEA_INSTANCE_URL: "http://gitea:3000"
GITEA_RUNNER_REGISTRATION_TOKEN: "xxxxxxx"
GITEA_RUNNER_NAME: "Gitea Runner"
volumes:
- ./gitea_runner:/data
- /var/run/docker.sock:/var/run/docker.sock
networks:
- gitea_network
networks:
gitea_network:
driver: bridge
external: true
Now, when i run the command: uses: actions/checkout@v4
under the file '.gitea/workflows/ci.yaml' in the repository.
i get the error :
fatal: unable to access 'http://gitea:3000/testuser/first_gitea_test/': Could not resolve host: gitea
What am i doing wrong? Why is the runner not recognizing Gitea? should it not have recognized it already? the runner already recognize the gitea server in the docker compose (otherwise the runner will not execute)
Upvotes: 0
Views: 92
Reputation: 1
The runner needs to be configured to run workflows in the same Docker network as Gitea (container.network in act_runner's configuration)
To specify the config file in command line: ./act_runner --config config.yaml
When running runner from docker compose, it accepts a CONFIG_FILE environment variable (see below for my docker compose) The compose file needs to be used with
docker compose -p gitea up -d
-p gitea is needed because docker adds the name of the project in the network name, which needs to be specified in the config.yaml file
networks:
gitea-network:
external: false
volumes:
postgres:
driver: local
gitea:
driver: local
runner:
driver: local
services:
runner:
image: gitea/act_runner
restart: unless-stopped
depends_on:
- server
networks:
- gitea-network
volumes:
- 'runner:/data'
- './config:/var/gitea-config'
- '/var/run/docker.sock:/var/run/docker.sock'
environment:
- 'CONFIG_FILE=/var/gitea-config/config.yaml'
- 'GITEA_INSTANCE_URL=http://giteaserver:3000'
- 'GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token>'
server:
image: 'docker.io/gitea/gitea:latest'
container_name: gitea
hostname: giteaserver
environment:
- 'GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token>'
- 'USER_UID=1000'
- 'USER_GID=1000'
- 'GITEA__database__DB_TYPE=postgres'
- 'GITEA__database__HOST=db:5432'
- 'GITEA__database__NAME=gitea'
- 'GITEA__database__USER=gitea'
- 'GITEA__database__PASSWD=<database_password>'
restart: unless-stopped
networks:
- gitea-network
volumes:
- 'gitea:/data'
- '/etc/timezone:/etc/timezone:ro'
- '/etc/localtime:/etc/localtime:ro'
ports:
- '3000:3000'
- '2222:22'
depends_on:
- db
db:
image: 'docker.io/library/postgres:14'
restart: unless-stopped
networks:
- gitea-network
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=<database_password>
- POSTGRES_DB=gitea
volumes:
- 'postgres:/var/lib/postgresql/data'
Here is my config.yaml file that needs to be in ./config folder (to create a new config file with default values you can run ./act_runner generate-config > config.yaml
)
runner:
file: .runner
capacity: 1
timeout: 3h
shutdown_timeout: 0s
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels:
- "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
- "ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04"
- "ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04"
cache:
enabled: true
dir: ""
host: ""
external_server: ""
container:
privileged: false
network: "gitea_gitea-network"
workdir_parent:
valid_volumes: []
docker_host: ""
force_pull: true
force_rebuild: false
host:
workdir_parent:
Upvotes: 0