首页 > 系统 > Linux教程

docker配置Runner容器的方法

admin Linux教程 2022-02-10 05:14:35 docker配置Runner   docker   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:/# 

在这里插入图片描述

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内容请搜索潘少俊衡以前的文章或继续浏览下面的相关文章希望大家以后多多支持潘少俊衡!

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
本文地址:/jtjc/Linux/104861.html

留言与评论(共有 0 条评论)
   
验证码:

潘少俊衡

| 桂ICP备2023010378号-4

Powered By EmpireCMS

爱享小站

中德益农

谷姐神农

环亚肥料

使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

感谢潘少俊衡友情技术支持