← 返回命令列表

Linux command

gitlab-runner 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Register a new runner

sudo gitlab-runner register

List configured runners

gitlab-runner list

Start the runner service

sudo gitlab-runner start

Stop the runner service

sudo gitlab-runner stop

Run in foreground

gitlab-runner run

Verify runner connections

gitlab-runner verify

Unregister a runner

sudo gitlab-runner unregister --name [runner_name]

Check runner status

gitlab-runner status

Reset runner authentication token

sudo gitlab-runner reset-token --name [runner_name]

说明

gitlab-runner is the agent that runs CI/CD jobs for GitLab. It connects to a GitLab instance, receives job requests, executes them in isolated environments, and reports results back. Runners can be shared across projects or dedicated to specific ones. The runner supports multiple executors: shell (directly on host), docker (in containers), docker-machine (auto-scaled Docker), kubernetes (in K8s pods), virtualbox, parallels, and ssh. The Docker executor is most common for isolated, reproducible builds. Registration requires a GitLab URL and registration token from the project/group/admin CI settings. Runners can operate as a system service or run in the foreground for debugging.

参数

register
Register a new runner with GitLab instance.
list
List all configured runners.
start
Start the runner service.
stop
Stop the runner service.
restart
Restart the runner service.
status
Show runner service status.
run
Run the runner in foreground.
run-single
Execute a single build from a GitLab instance.
verify
Verify runner connections to GitLab.
unregister
Remove a runner from GitLab.
reset-token
Reset a runner's authentication token.
install
Install as system service.
uninstall
Remove system service.
--debug
Enable debug logging.
--log-level _level_
Log level: debug, info, warn, error, fatal, panic.
--log-format _format_
Log format: runner, text, json.
--config _file_
Use alternate config file.
--working-directory _path_
Set custom working directory.

FAQ

What is the gitlab-runner command used for?

gitlab-runner is the agent that runs CI/CD jobs for GitLab. It connects to a GitLab instance, receives job requests, executes them in isolated environments, and reports results back. Runners can be shared across projects or dedicated to specific ones. The runner supports multiple executors: shell (directly on host), docker (in containers), docker-machine (auto-scaled Docker), kubernetes (in K8s pods), virtualbox, parallels, and ssh. The Docker executor is most common for isolated, reproducible builds. Registration requires a GitLab URL and registration token from the project/group/admin CI settings. Runners can operate as a system service or run in the foreground for debugging.

How do I run a basic gitlab-runner example?

Run `sudo gitlab-runner register` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does register do in gitlab-runner?

Register a new runner with GitLab instance.