---
# System prepended metadata

title: How to add a new CI

---

# How to add a new CI
read more: `https://docs.gitlab.com/runner/`

## Docker

### Setup Docker and install GitLab Runner

#### Install

```bash
curl -sSL https://get.docker.com/ | sh
```

#### Run GitLab Runner in a container

```bash
docker run <chosen docker options...> \
    gitlab/gitlab-runner <Runner command and options...>
```

Example:

```bash
docker run --rm -t -i gitlab/gitlab-runner --help
```

#### Docker Images installation

1.You need to mount a config volume into the gitlab-runner container to be used for configs and other resources:

```bash 
docker run -d --name gitlab-runner --restart always \
  -v /srv/gitlab-runner/config:/etc/gitlab-runner \
  -v /var/run/docker.sock:/var/run/docker.sock \
```

Tip: On macOS, use /Users/Shared instead of /srv.

Or, you can use a config container to mount your custom data volume:

```bash 
docker run -d --name gitlab-runner-config \
    -v /etc/gitlab-runner \
    busybox:latest \
    /bin/true
```
And then, run the Runner:

```bash
docker run -d --name gitlab-runner --restart always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --volumes-from gitlab-runner-config \
    gitlab/gitlab-runner:latest
```


2. Register the runner you just launched by following the instructions in the [Docker section of Registering Runners](https://docs.gitlab.com/runner/register/index.html#docker) or below. The runner won’t pick up any jobs until it’s registered.



## Registering Runners

These instructions are meant to be followed after Run GitLab Runner in a container. In this section, you will launch an ephemeral gitlab-runner container to register the container that you created during install. After you finish registration, the resulting configuration will be written to your chosen config volume (e.g. /srv/gitlab-runner/config), and will be automatically loaded by the runner using that config volume.

To register a Runner using a Docker container:


You can click the [link](https://docs.gitlab.com/runner/register/index.html#docker) or follow the instruction below:

Registering Runners
1. Run the register command:

```bash
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner \
    gitlab/gitlab-runner register
```

And to fill all info for gitlab-runner register, in your repo: Settings > CI/CD > Runners

You’ll be asked for the default image to be used for projects that do not define one in .gitlab-ci.yml:

Please enter the Docker image (eg. ruby:2.6):
<your Docker image>

## Write script

- Create file .gitlab-ci.yml  in your project, [readmore](https://docs.gitlab.com/ee/ci/)

