Skip to content
Snippets Groups Projects
Commit abe59400 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Update docker documentation

parent 5a35b64d
Branches
Tags
No related merge requests found
......@@ -10,6 +10,6 @@ RUN wget -O /tmp/glibc.apk "https://circle-artifacts.com/gh/andyshinn/alpine-pkg
RUN wget -O /usr/bin/gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64 && \
chmod +x /usr/bin/gitlab-ci-multi-runner
VOLUME ["/etc/gitlab-runner"]
VOLUME ["/etc/gitlab-runner", "/var/run/docker.sock"]
ENTRYPOINT ["gitlab-ci-multi-runner"]
CMD ["run"]
......@@ -12,6 +12,6 @@ RUN echo "deb https://packages.gitlab.com/runner/gitlab-ci-multi-runner/ubuntu/
ADD entrypoint /
RUN chmod +x /entrypoint
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner", "/var/run/docker.sock"]
ENTRYPOINT ["/entrypoint"]
CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"]
## Run gitlab-ci-multi-runner in a container
## Run gitlab-runner in a container
### Docker image installation and configuration
......@@ -8,39 +8,42 @@ Install Docker first:
curl -sSL https://get.docker.com/ | sh
```
We need to mount a data volume into our gitlab-ci-multi-runner container to
We need to mount a config volume into our gitlab-runner container to
be used for configs and other resources:
```bash
docker run -d --name multi-runner --restart always \
-v /PATH/TO/DATA/FOLDER:/data \
ayufan/gitlab-ci-multi-runner:latest
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest
```
OR you can use a data container to mount you custom data volume:
OR you can use a config container to mount your custom data volume:
```bash
docker run -d --name multi-runner-data -v /data busybox:latest /bin/true
docker run -d --name multi-runner --restart always \
--volumes-from multi-runner-data \
ayufan/gitlab-ci-multi-runner:latest
docker run -d --name gitlab-runner-config \
-v /etc/gitlab-runner \
busybox:latest \
/bin/true
docker run -d --name gitlab-runner --restart always \
--volumes-from gitlab-runner-config \
gitlab/gitlab-runner:latest
```
If you plan on using Docker as the method of spawing runners, you will need to
mount your docker socket like:
If you plan on using Docker as the method of spawning runners, you will need to
mount your docker socket like this:
```bash
docker run -d --name multi-runner --restart always \
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /PATH/TO/DATA/FOLDER:/data \
ayufan/gitlab-ci-multi-runner:latest
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest
```
Register the runner:
```bash
docker exec -it multi-runner gitlab-ci-multi-runner register
docker exec -it gitlab-runner register
Please enter the gitlab-ci coordinator URL (e.g. http://gitlab-ci.org:3000/ )
https://ci.gitlab.org/
......@@ -57,33 +60,33 @@ INFO[0037] Runner registered successfully. Feel free to start it, but if it's
running already the config should be automatically reloaded!
```
The runner should be started already and you are ready to build your projects!
The runner should is started already and you are ready to build your projects!
### Update
Pull the latest version:
```bash
docker pull ayufan/gitlab-ci-multi-runner:latest
docker pull gitlab/gitlab-runner:latest
```
Stop and remove the existing container:
```bash
docker stop multi-runner && docker rm multi-runner
docker stop gitlab-runner && docker rm gitlab-runner
```
Start the container as you did originally:
```bash
docker run -d --name multi-runner --restart always \
--volumes-from multi-runner-data \
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
ayufan/gitlab-ci-multi-runner:latest
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest
```
**Note**: you need to use the same method for mounting you data volume as you
did originally (`-v /PATH/TO/DATA/FOLDER:/data` or `--volumes-from multi-runner-data`)
did originally (`-v /srv/gitlab-runner/config:/etc/gitlab-runner` or `--volumes-from gitlab-runner`)
### Installing Trusted SSL Server Certificates
......@@ -91,8 +94,8 @@ If your GitLab CI server is using self-signed SSL certificates then you should
make sure the GitLab CI server certificate is trusted by the gitlab-ci-multi-runner
container for them to be able to talk to each other.
The gitlab-ci-multi-runner image is configured to look for the trusted SSL
certificates at `/data/certs/ca.crt`, this can however be changed using the
The `gitlab/gitlab-runner` image is configured to look for the trusted SSL
certificates at `/etc/gitlab-runner/certs/ca.crt`, this can however be changed using the
`-e "CA_CERTIFICATES_PATH=/DIR/CERT"` configuration option.
Copy the `ca.crt` file into the `certs` directory on the data volume (or container).
......@@ -100,3 +103,15 @@ The `ca.crt` file should contain the root certificates of all the servers you
want gitlab-ci-multi-runner to trust. The gitlab-ci-multi-runner container will
import the `ca.crt` file on startup so if your container is already running you
may need to restart it for the changes to take effect.
### Alpine Linux
You can also use alternative [Alpine Linux](https://www.alpinelinux.org/) based image with much smaller footprint:
```
gitlab/gitlab-runner latest 3e8077e209f5 13 hours ago 304.3 MB
gitlab/gitlab-runner alpine 7c431ac8f30f 13 hours ago 25.98 MB
```
**Alpine Linux image is designed to use only Docker as the method of spawning runners.**
The original `gitlab/gitlab-runner:latest` is based on Ubuntu 14.04 LTS.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment