Container 환경에서 gitlab-runner를 생성하고 GitLab에 등록 하는 절차에 관한 내용 입니다.
- Container 생성
[test@test-runner ~]$ docker run --detach \ > --name gitlab-runner \ > --restart always \ > --volume /srv/gitlab-runner/config:/etc/gitlab-runner \ > --volume /var/run/docker.sock:/var/run/docker.sock \ > gitlab/gitlab-runner:latest Unable to find image 'gitlab/gitlab-runner:latest' locally latest: Pulling from gitlab/gitlab-runner d9802f032d67: Pull complete d71acd29818d: Pull complete 2df872e9a082: Pull complete Digest: sha256:c7e23480375fca186743d8fbf6eff3b682da48b70a9d2980ce89863571fb6fa8 Status: Downloaded newer image for gitlab/gitlab-runner:latest 4f0eb91d3bd9cdc008545ab664e5746de3eefff6f92fce380dd4b29d290c8154 [test@test-runner ~]$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4f0eb91d3bd9 gitlab/gitlab-runner:latest "/usr/bin/dumb-init …" About a minute ago Up About a minute gitlab-runner
2. gitlab-runner 등록을 위한 token 정보 확인

3. 생성된 gitlab-runner를 GitLab에 등록
[test@test-runner ~]$ docker container exec -it gitlab-runner bash root@4f0eb91d3bd9:/# gitlab-runner register -n \ > --url http://192.168.0.100:8081/ \ > --registration-token <gitlab token> \ > --description gitlab-runner \ > --executor docker \ > --docker-image docker:latest \ > --docker-volumes /var/run/docker.sock:/var/run/docker.sock Runtime platform arch=amd64 os=linux pid=24 revision=374d34fd version=17.6.0 Running in system-mode. WARNING: Support for registration tokens and runner parameters in the 'register' command has been deprecated in GitLab Runner 15.6 and will be replaced with support for authentication tokens. For more information, see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow Registering runner... succeeded runner=JdXqqyrV Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml"
4. gitlab-runner 등록 확인
