欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

docker配置Runner容器的方法

程序员文章站 2022-03-06 09:21:08
1.创建runner容器mk@mk-pc:~/桌面$ docker run -di --name my-runner --net my-gitlab-net gitlab/gitlab-runner:...

1.创建runner容器

mk@mk-pc:~/桌面$ docker run -di --name my-runner --net my-gitlab-net gitlab/gitlab-runner:latest
addc6e08521a6f707494c7a05e63670331c76baaf261282bdd17e2e24268583b

2.配置runner和gitlab做一个关联

root@addc6e08521a:/# gitlab-runner register
runtime platform                                    arch=amd64 os=linux pid=262 revision=4b9e985a version=14.4.0
running in system-mode.                            
                                                   
enter the gitlab instance url (for example, https://gitlab.com/):
http://192.168.88.2/
enter the registration token:
mql7cpxdubkv55pewo7a
enter a description for the runner:
[addc6e08521a]: my first runner
enter tags for the runner (comma-separated):
dockercicd
registering runner... succeeded                     runner=mql7cpxd
enter an executor: docker, parallels, ssh, custom, shell, virtualbox, docker+machine, docker-ssh+machine, kubernetes, docker-ssh:
docker
enter the default docker image (for example, ruby:2.6):
app
runner registered successfully. feel free to start it, but if it's running already the config should be automatically reloaded! 
root@addc6e08521a:/# 

docker配置Runner容器的方法

3.编写流水线文件

.gitlab-ci.yml

stages:
  - build
  - deploy

build:
  stage: build
  tags:
    - build
  only:
    - dev
  script:
    - echo "mvn clean"
    - echo "mvn install"

deploy:
  stage: deploy
  tags:
    - deploy
  only:
    - dev
  script:
    - echo "java -jar  dxxx"

运行流水线

docker配置Runner容器的方法

到此这篇关于docker配置runner的文章就介绍到这了,更多相关docker配置runner内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

相关标签: docker Runner